bug 14216: rightly initializing to avoid NPE

This commit is contained in:
Abhi 2012-03-21 14:57:09 +05:30
parent 99000f5d6e
commit d3673506cf
1 changed files with 2 additions and 5 deletions

View File

@ -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);