]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
fix: check if parsing a variable initializer failed
authorWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 23 Aug 2012 11:30:30 +0000 (13:30 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 23 Aug 2012 11:30:30 +0000 (13:30 +0200)
parser.c

index 077302633c8cd9a8c46d1e3f56c5c5d9d96649fc..657a35f0a5338495c382060c3e059f8303d48cdb 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2509,6 +2509,11 @@ nextvar:
             ast_value      *cval;
 
             cexp = parser_expression_leave(parser, true);
+            if (!cexp) {
+                ast_value_delete(typevar);
+                return false;
+            }
+
             cval = (ast_value*)cexp;
             if (!ast_istype(cval, ast_value) || !cval->isconst)
                 parseerror(parser, "cannot initialize a global constant variable with a non-constant expression");