Skip the SAVE subcommand if no valid data are present, instead of crashing.
authorJason H Stover <jhs@math.gcsu.edu>
Mon, 9 Feb 2009 16:27:00 +0000 (11:27 -0500)
committerJason H Stover <jhs@math.gcsu.edu>
Mon, 9 Feb 2009 16:27:00 +0000 (11:27 -0500)
Fix for bug 25523

src/language/stats/regression.q

index 595e7e750c54d4d996b85b71eb141f87b4ba8d52..d82d5549adf3ea6e96ff308f442c03a55d94a7b3 100644 (file)
@@ -689,17 +689,21 @@ subcommand_save (struct dataset *ds, int save, pspp_linreg_cache ** models)
 
       for (lc = models; lc < models + cmd.n_dependent; lc++)
        {
-         assert (*lc != NULL);
-         assert ((*lc)->depvar != NULL);
-         if (cmd.a_save[REGRESSION_SV_RESID])
-           {
-             reg_save_var (ds, "RES", regression_trns_resid_proc, *lc,
-                           &(*lc)->resid, n_trns);
-           }
-         if (cmd.a_save[REGRESSION_SV_PRED])
+         if (*lc != NULL)
            {
-             reg_save_var (ds, "PRED", regression_trns_pred_proc, *lc,
-                           &(*lc)->pred, n_trns);
+             if ((*lc)->depvar != NULL)
+               {
+                 if (cmd.a_save[REGRESSION_SV_RESID])
+                   {
+                     reg_save_var (ds, "RES", regression_trns_resid_proc, *lc,
+                                   &(*lc)->resid, n_trns);
+                   }
+                 if (cmd.a_save[REGRESSION_SV_PRED])
+                   {
+                     reg_save_var (ds, "PRED", regression_trns_pred_proc, *lc,
+                                   &(*lc)->pred, n_trns);
+                   }
+               }
            }
        }
     }