Look for null pointer on account id before trying to update usage when releasing

an IP. This seems to be possible if expunge fails at some point after freeing
an IP, on subsequent expunge tries the IP is freed already and gets null pointer
when looking for account id.

BUG-ID: CLOUDSTACK-2279
Bugfix-for: 4.1,4.2
Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1367251304 -0600
This commit is contained in:
Marcus Sorensen 2013-04-29 10:01:44 -06:00
parent 8545e68aaf
commit a0dbf89090

View File

@ -2886,7 +2886,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
}
// Save usage event
if (ip.getAllocatedToAccountId() != Account.ACCOUNT_ID_SYSTEM) {
if (ip.getAllocatedToAccountId() != null && ip.getAllocatedToAccountId() != Account.ACCOUNT_ID_SYSTEM) {
VlanVO vlan = _vlanDao.findById(ip.getVlanId());
String guestType = vlan.getVlanType().toString();