You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2015/11/29 20:20:31 UTC

[math] Prevent null pointer exception at integration start.

Repository: commons-math
Updated Branches:
  refs/heads/field-ode d724f4edd -> e6c84480c


Prevent null pointer exception at integration start.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e6c84480
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e6c84480
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e6c84480

Branch: refs/heads/field-ode
Commit: e6c84480c11877073bb77a74e857fcf427409155
Parents: d724f4e
Author: Luc Maisonobe <lu...@apache.org>
Authored: Sun Nov 29 20:20:18 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Sun Nov 29 20:20:18 2015 +0100

----------------------------------------------------------------------
 .../math3/ode/sampling/AbstractFieldStepInterpolator.java        | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e6c84480/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
index bb3d722..6692222 100644
--- a/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java
@@ -160,7 +160,9 @@ public abstract class AbstractFieldStepInterpolator<T extends RealFieldElement<T
 
         globalCurrentState = state;
         softCurrentState   = globalCurrentState;
-        h                  = globalCurrentState.getTime().subtract(globalPreviousState.getTime());
+        if (globalPreviousState != null) {
+            h = globalCurrentState.getTime().subtract(globalPreviousState.getTime());
+        }
 
         // the step is not finalized anymore
         finalized  = false;