X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Flexer%2Fvariable-parser.c;h=e637940351af76439ea397dbf3c067cfddfef6a0;hb=1a3cd68a1a0cbf51ea44514ffe92aedf7b7657b3;hp=d80c25ee6b644e8d6c29be2aa87016cecc446e7b;hpb=96994a54e60e9c95b8bba54c2281acf7059b1203;p=pspp diff --git a/src/language/lexer/variable-parser.c b/src/language/lexer/variable-parser.c index d80c25ee6b..e637940351 100644 --- a/src/language/lexer/variable-parser.c +++ b/src/language/lexer/variable-parser.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012, 2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -123,7 +123,8 @@ parse_variable (struct lexer *lexer, const struct dictionary *d) /* Parses a set of variables from dictionary D given options OPTS. Resulting list of variables stored in *VAR and the number of variables into *CNT. Returns true only if - successful. */ + successful. The dictionary D must contain at least one + variable. */ bool parse_variables (struct lexer *lexer, const struct dictionary *d, struct variable ***var, @@ -137,6 +138,12 @@ parse_variables (struct lexer *lexer, const struct dictionary *d, assert (cnt != NULL); vs = var_set_create_from_dict (d); + if (var_set_get_cnt (vs) == 0) + { + *cnt = 0; + var_set_destroy (vs); + return false; + } success = parse_var_set_vars (lexer, vs, var, cnt, opts); var_set_destroy (vs); return success;