From: jussi.koskela Date: Wed, 18 Jun 2014 12:17:53 +0000 (+0000) Subject: fixes #4966 X-Git-Tag: 1.8.1~17 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=2383f6f7faac38145187b6a94b0e58de5324c545;p=simantics%2Fsysdyn.git fixes #4966 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29651 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java index d23ce826..c414f3d6 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java @@ -20,8 +20,8 @@ public class ValueIndexVariableI extends ValueIndexVariableBase { @Override public Double getValue() { double[] array = getValueFull(); - if(array == null || array.length < index+1) return Double.NaN; - return array[0]; + if(array == null || index < 0 || array.length < index+1) return Double.NaN; + return array[index]; } @Override @@ -29,7 +29,7 @@ public class ValueIndexVariableI extends ValueIndexVariableBase { ensureInformationAvailable(graph); double[] existing = getValueFull(); double[] newValue = Arrays.copyOf(existing, existing.length); - newValue[0] = (Double)value; + newValue[index] = (Double)value; super.setValue(graph, newValue); }