From: Tuukka Lehtonen Date: Fri, 13 Oct 2017 06:08:57 +0000 (+0300) Subject: Fixed NPE in TimeSeriesEditor.ActiveRunListener X-Git-Tag: v1.31.0~124 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=378e6081c6ce13fededdbeefbd66c77435e7ff6f;p=simantics%2Fplatform.git Fixed NPE in TimeSeriesEditor.ActiveRunListener refs #7544 Change-Id: Id9ba7f7d698b3a98b44cae80173fb686971658c0 --- diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java index d83a37ad4..4f633fbe6 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/TimeSeriesEditor.java @@ -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() {