]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
Don't add redeclared globals a second time
[xonotic/gmqcc.git] / parser.c
index 338993ac4fa773a4d283fd389ed233784b4739b0..1268d03a5839245addbdf23df30eff0efbd2086b 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3739,6 +3739,15 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
                                 retval = false;
                                 goto cleanup;
                             }
+                            proto = (ast_value*)old;
+                            if (!ast_istype(old, ast_value)) {
+                                parseerror(parser, "internal error: not an ast_value");
+                                retval = false;
+                                proto = NULL;
+                                goto cleanup;
+                            }
+                            ast_delete(var);
+                            var = proto;
                         }
                     }
                     if (opts_standard == COMPILER_QCC &&