Skip to content

Commit

Permalink
Merge pull request #3021 from eclipse/fix-npeConfigurableResource
Browse files Browse the repository at this point in the history
fix npe on AbstractKapuaConfigurableResourceLimitedService
  • Loading branch information
Coduz authored Jul 9, 2020
2 parents ddad25b + 0217971 commit 5d43729
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ protected int allowedChildEntities(KapuaId scopeId, KapuaId targetScopeId, Map<S
long childCount = 0;
for (Account childAccount : childAccounts.getItems()) {
Map<String, Object> childConfigValues = getConfigValues(childAccount);
int maxChildChildAccounts = (int) childConfigValues.get("maxNumberChildEntities");
childCount += maxChildChildAccounts;
// maxNumberChildEntities can be null if such property is disabled via the
// isPropertyEnabled() method in the service implementation. In such case,
// it makes sense to treat the service as it had 0 available entities
Integer maxNumberChildEntities = (Integer) childConfigValues.get("maxNumberChildEntities");
childCount += maxNumberChildEntities != null ? maxNumberChildEntities : 0;
}

// Max allowed for this account
Expand Down

0 comments on commit 5d43729

Please sign in to comment.