From: Wolfgang (Blub) Bumiller <blub@speed.at>
Date: Sun, 25 Nov 2012 22:35:31 +0000 (+0100)
Subject: Don't add redeclared globals a second time
X-Git-Tag: 0.1.9~215
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0af62801f46727e27f84472ddf4033f7527ee0e2;p=xonotic%2Fgmqcc.git

Don't add redeclared globals a second time
---

diff --git a/parser.c b/parser.c
index 338993a..1268d03 100644
--- 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 &&