Fix possible null pointer dereference in linreg_predict.
[pspp] / src / math / linreg.c
index d1e0dae980e1e12c03e312b0fcbf7fd6139b6fb7..f88a18a5b804fa5861c7c45d5762e375c43274ed 100644 (file)
@@ -275,11 +275,11 @@ linreg_predict (const struct linreg *c, const double *vals, size_t n_vals)
   size_t j;
   double result;
 
-  assert (n_vals == c->n_coeffs);
   if (vals == NULL || c == NULL)
     {
       return GSL_NAN;
     }
+  assert (n_vals == c->n_coeffs);
   if (c->coeff == NULL)
     {
       /* The stupid model: just guess the mean. */