]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java
Fixed NPE in TimeSeriesEditor.ActiveRunListener
[simantics/platform.git] / 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() {