]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
More bug fixes and dead code elimination
[xonotic/gmqcc.git] / parser.c
index 49e965a097f0e5813023824e85062b38e3100da8..f9793471f94f93bc4314c3be5f9d3ea88dd221a8 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2755,7 +2755,12 @@ static bool parse_dowhile(parser_t *parser, ast_block *block, ast_expression **o
     if (vec_last(parser->breaks) != label || vec_last(parser->continues) != label) {
         parseerror(parser, "internal error: label stack corrupted");
         rv = false;
-        ast_delete(*out);
+        /*
+         * Test for NULL otherwise ast_delete dereferences null pointer
+         * and boom.
+         */
+        if (*out)
+            ast_delete(*out);
         *out = NULL;
     }
     else {