From dfa612d1fe538274deea27f8a10ce8352aa39e5b Mon Sep 17 00:00:00 2001 From: Vijayendra Bhamidipati Date: Wed, 17 Jul 2013 10:46:35 -0700 Subject: [PATCH] CLOUDSTACK-3598: [Automation] NullPointerException observed while connecting agent Description: Fixing an NPE when setting resource count. --- .../src/com/cloud/configuration/dao/ResourceCountDaoImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java index cfd2137f479..9070ff912b3 100644 --- a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java +++ b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java @@ -98,7 +98,7 @@ public class ResourceCountDaoImpl extends GenericDaoBase @Override public void setResourceCount(long ownerId, ResourceOwnerType ownerType, ResourceType type, long count) { ResourceCountVO resourceCountVO = findByOwnerAndType(ownerId, ownerType, type); - if (count != resourceCountVO.getCount()) { + if (resourceCountVO != null && count != resourceCountVO.getCount()) { resourceCountVO.setCount(count); update(resourceCountVO.getId(), resourceCountVO); }