]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed NPE in TimeSeriesEditor.ActiveRunListener 02/1102/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 13 Oct 2017 06:08:57 +0000 (09:08 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 13 Oct 2017 06:10:59 +0000 (09:10 +0300)
refs #7544

Change-Id: Id9ba7f7d698b3a98b44cae80173fb686971658c0

bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java

index d83a37ad4f665241aed27d1b3618b1a549216714..4f633fbe6924c5478277604500b9ada221b2334d 100644 (file)
@@ -857,14 +857,14 @@ public class TimeSeriesEditor extends ResourceEditorPart {
         }
         @Override
         public void execute(ReadGraph graph, final Resource run) throws DatabaseException {
-               if(run != null) {
-                       SimulationResource SIMU = SimulationResource.getInstance(graph);
-                       Variable var = Variables.getVariable(graph, run);
-                       IExperiment exp = var.getPossiblePropertyValue(graph, SIMU.Run_iExperiment);
-                       ITrendSupport ts = exp.getService(ITrendSupport.class);
-                       if (ts != null)
-                           ts.setChartData(graph);
-               }
+            if(run != null) {
+                SimulationResource SIMU = SimulationResource.getInstance(graph);
+                Variable var = Variables.getPossibleVariable(graph, run);
+                IExperiment exp = var != null ? var.getPossiblePropertyValue(graph, SIMU.Run_iExperiment) : null;
+                ITrendSupport ts = exp != null ? exp.getService(ITrendSupport.class) : null;
+                if (ts != null)
+                    ts.setChartData(graph);
+            }
         }
         @Override
         public boolean isDisposed() {