PublicNetworkGuru: fixed NPE in ipUnassign

This commit is contained in:
alena 2011-02-01 16:07:00 -08:00
parent 27f2b6cbb1
commit d5bded3d6d
1 changed files with 3 additions and 1 deletions

View File

@ -154,7 +154,9 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
IPAddressVO ip = _ipAddressDao.findByAccountAndIp(vm.getVirtualMachine().getAccountId(), nic.getIp4Address());
_ipAddressDao.unassignIpAddress(ip.getId());
if (ip != null) {
_ipAddressDao.unassignIpAddress(ip.getId());
}
nic.deallocate();
}