Do sanity checks first to prevent NullPointerException.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1499076 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-07-02 19:49:48 +00:00
parent 9d5ce00453
commit 9fb08c2f9e

View File

@ -677,13 +677,15 @@ public class MathArrays {
double[] ... yList)
throws NullArgumentException,
DimensionMismatchException {
final int yListLen = yList.length;
final int len = x.length;
// Consistency checks.
if (x == null) {
throw new NullArgumentException();
}
final int yListLen = yList.length;
final int len = x.length;
for (int j = 0; j < yListLen; j++) {
final double[] y = yList[j];
if (y == null) {