Merge remote-tracking branch 'origin/master' into sheet
[pspp] / src / language / lexer / variable-parser.c
index 8c4f8fe8a61acff13b83aee122c76ed2b4140e6c..d160b6f9791780a40b51000837a4c0fe3fadc2b4 100644 (file)
@@ -201,9 +201,9 @@ add_variable (struct variable ***v, size_t *nv, size_t *mv,
                "All variables in this variable list must have the "
                "same width.  %s will be omitted from the list."),
          var_get_name ((*v)[0]), add_name, add_name);
-  else if ((pv_opts & PV_NO_DUPLICATE) && included[idx])
+  else if ((pv_opts & PV_NO_DUPLICATE) && included && included[idx])
     msg (SE, _("Variable %s appears twice in variable list."), add_name);
-  else if ((pv_opts & PV_DUPLICATE) || !included[idx])
+  else if ((pv_opts & PV_DUPLICATE) || !included || !included[idx])
     {
       if (*nv >= *mv)
         {
@@ -633,7 +633,10 @@ parse_mixed_vars (struct lexer *lexer, const struct dictionary *dict,
       else if (!parse_DATA_LIST_vars (lexer, dict, names, nnames, PV_APPEND))
        goto fail;
     }
-  return 1;
+  if (*nnames == 0)
+    goto fail;
+
+  return true;
 
 fail:
   for (i = 0; i < *nnames; i++)
@@ -641,7 +644,7 @@ fail:
   free (*names);
   *names = NULL;
   *nnames = 0;
-  return 0;
+  return false;
 }
 
 /* Parses a list of variables where some of the variables may be
@@ -921,7 +924,7 @@ parse_internal_interaction (struct lexer *lexer, const struct dictionary *dict,
       *iact = NULL;
       return false;
     }
-  
+
   assert (v);
 
   if ( *iact == NULL)