]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
(refs #7242) Fixed NPE in SCLModuleTree 63/563/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Mon, 29 May 2017 09:15:18 +0000 (12:15 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Mon, 29 May 2017 09:15:18 +0000 (12:15 +0300)
A null input must be handled when the component is disposed.

Change-Id: I915c68aa3d15b4d5a3cbd89220bd3701f262fee1

bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTree.java

index 6ce186f2f76b58cf591a9085406206dc3f2750bb..acaffd0f565103cd2301e006794f84304961a574 100644 (file)
@@ -23,11 +23,14 @@ public class SCLModuleTree extends TreeViewer {
 
         @Override
         public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-            this.rootEntry = createModuleTreeEntry((Collection<String>)newInput);
+            if(newInput != null)
+                this.rootEntry = createModuleTreeEntry((Collection<String>)newInput);
         }
 
         @Override
         public Object[] getElements(Object inputElement) {
+            if(rootEntry == null)
+                return new Object[0];
             return rootEntry.children().toArray();
         }