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 committed by Chip Childers
parent 06371babe8
commit c7f43d8d69
1 changed files with 1 additions and 1 deletions

View File

@ -2793,7 +2793,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();