Skip to content

Commit

Permalink
fix npe on AbstractKapuaConfigurableResourceLimitedService if maxNumb…
Browse files Browse the repository at this point in the history
…erChildEntities not present

Signed-off-by: riccardomodanese <riccardo.modanese@eurotech.com>
  • Loading branch information
riccardomodanese authored and Claudio Mezzasalma committed Jul 8, 2020
1 parent 44849de commit e081714
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;
// maxNumberChildEntites 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 e081714

Please sign in to comment.