core: Fix potential NPE

Fix a potential NPE around setting task status.
This issue was reported by coverity

Change-Id: I9f82f6d4aeb5adbdb1c33d024b6f7864dbd12899
Signed-off-by: Yair Zaslavsky <yzaslavs@redhat.com>