Skip to content

Commit 13b2c90

Browse files
committed
ST6RI-924 Avoid possible NPE removing unnecessary implicit general types
1 parent 87eb972 commit 13b2c90

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

org.omg.sysml/src/org/omg/sysml/adapter/TypeAdapter.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,17 @@ public void removeUnnecessaryImplicitGeneralTypes() {
359359
implicitGeneralTypes.values().forEach(implicitGenerals::addAll);
360360
for (Object eClass: implicitGeneralTypes.keySet().toArray()) {
361361
List<Type> implicitEClassGenerals = implicitGeneralTypes.get(eClass);
362-
if (eClass == SysMLPackage.eINSTANCE.getRedefinition()) {
363-
implicitEClassGenerals.removeAll(redefinedFeatures);
364-
} else {
365-
implicitEClassGenerals.removeIf(gen->
366-
generals.stream().anyMatch(type->specializesExcludingTarget(type, gen)) ||
367-
implicitGenerals.stream().anyMatch(type->type != gen && specializesExcludingTarget(type, gen)));
368-
}
369-
if (implicitEClassGenerals.isEmpty()) {
370-
implicitGeneralTypes.remove(eClass);
362+
if (implicitEClassGenerals != null) {
363+
if (eClass == SysMLPackage.eINSTANCE.getRedefinition()) {
364+
implicitEClassGenerals.removeAll(redefinedFeatures);
365+
} else {
366+
implicitEClassGenerals.removeIf(gen->
367+
generals.stream().anyMatch(type->specializesExcludingTarget(type, gen)) ||
368+
implicitGenerals.stream().anyMatch(type->type != gen && specializesExcludingTarget(type, gen)));
369+
}
370+
if (implicitEClassGenerals.isEmpty()) {
371+
implicitGeneralTypes.remove(eClass);
372+
}
371373
}
372374
}
373375

0 commit comments

Comments
 (0)