CLOUDSTACK-3598: [Automation] NullPointerException observed while connecting agent

Description:

    Fixing an NPE when setting resource count.
This commit is contained in:
Vijayendra Bhamidipati 2013-07-17 10:46:35 -07:00 committed by Sheng Yang
parent 876a7b3361
commit dfa612d1fe

View File

@ -98,7 +98,7 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long>
@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);
}