Sfoglia il codice sorgente

fixed NPE during scoping of active expressions within state charts

Andreas Muelder 8 anni fa
parent
commit
3c79c3d71e

+ 5 - 1
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java

@@ -121,10 +121,14 @@ public class STextScopeProvider extends ExpressionsScopeProvider {
 	}
 
 	protected List<ImportNormalizer> getActiveStateNormalizer(EObject context) {
+		List<ImportNormalizer> normalizer = Lists.newArrayList();
 		SpecificationElement contextElement = getContextElement(context);
+		if(contextElement == null)
+			return normalizer;
 		Region containingRegion = EcoreUtil2.getContainerOfType(contextElement, Region.class);
+		if(containingRegion == null)
+			return normalizer; 
 		QualifiedName fullyQualifiedName = nameProvider.getFullyQualifiedName(containingRegion);
-		List<ImportNormalizer> normalizer = Lists.newArrayList();
 		while (!fullyQualifiedName.getSegments().isEmpty()) {
 			normalizer.add(new ImportNormalizer(fullyQualifiedName, true, false));
 			fullyQualifiedName = fullyQualifiedName.skipLast(1);