From d3673506cf3aec8ef9f4f8e0a172f6ebec448505 Mon Sep 17 00:00:00 2001 From: Abhi Date: Wed, 21 Mar 2012 14:57:09 +0530 Subject: [PATCH] bug 14216: rightly initializing to avoid NPE --- server/src/com/cloud/vm/VirtualMachineManagerImpl.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 674e8d2bb0b..650ced468b4 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -1602,13 +1602,10 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene VMInstanceVO castedVm = null; if (info == null) { info = new AgentVmInfo(vm.getInstanceName(), getVmGuru(vm), vm, State.Stopped); - castedVm = info.guru.findById(vm.getId()); - } else { - castedVm = info.vm; - } + } + castedVm = info.guru.findById(vm.getId()); HypervisorGuru hvGuru = _hvGuruMgr.getGuru(castedVm.getHypervisorType()); - Command command = compareState(hostId, castedVm, info, true, hvGuru.trackVmHostChange()); if (command != null) { commands.addCommand(command);