]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
fix: check if parsing a variable initializer failed
[xonotic/gmqcc.git] / 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");