core : check getVm() return value to avoid NPE

getVm() can return null, which might cause to an NPE.

Change-Id: Id404b00d85ab327e2943ce8d37a6f6c30e76d2f5
Signed-off-by: Liron Aravot <laravot@redhat.com>