From: Hannu Niemistö Date: Mon, 29 May 2017 09:15:18 +0000 (+0300) Subject: (refs #7242) Fixed NPE in SCLModuleTree X-Git-Tag: v1.29.0~18 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=043ed4538f5bdc16d299bc40c2dd8285a3120f9b;p=simantics%2Fplatform.git (refs #7242) Fixed NPE in SCLModuleTree A null input must be handled when the component is disposed. Change-Id: I915c68aa3d15b4d5a3cbd89220bd3701f262fee1 --- diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTree.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTree.java index 6ce186f2f..acaffd0f5 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTree.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/modulebrowser/SCLModuleTree.java @@ -23,11 +23,14 @@ public class SCLModuleTree extends TreeViewer { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - this.rootEntry = createModuleTreeEntry((Collection)newInput); + if(newInput != null) + this.rootEntry = createModuleTreeEntry((Collection)newInput); } @Override public Object[] getElements(Object inputElement) { + if(rootEntry == null) + return new Object[0]; return rootEntry.children().toArray(); }