diff --git a/src/main/java/org/apache/commons/math4/ode/FieldODEState.java b/src/main/java/org/apache/commons/math4/ode/FieldODEState.java index 1c7bbe630..de01d97a5 100644 --- a/src/main/java/org/apache/commons/math4/ode/FieldODEState.java +++ b/src/main/java/org/apache/commons/math4/ode/FieldODEState.java @@ -113,7 +113,7 @@ public class FieldODEState> { * @return number of secondary states. */ public int getNumberOfSecondaryStates() { - return secondaryState.length; + return secondaryState == null ? 0 : secondaryState.length; } /** Get secondary state dimension.