]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
set olddecl so we don't access a NULL value when a variable already exists
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 18 Aug 2012 19:31:53 +0000 (21:31 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 18 Aug 2012 19:31:53 +0000 (21:31 +0200)
parser.c

index 0a8d537a2d7bb7140e03e1b580538fb934235b45..0b9428c6cda7ebeac1a6f77d781f7f672e89f054 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1801,7 +1801,7 @@ static bool parser_variable(parser_t *parser, ast_block *localblock)
                 return false;
             }
 
-            if (localblock && parser_find_local(parser, parser_tokval(parser), parser->blocklocal)) {
+            if (localblock && (olddecl = parser_find_local(parser, parser_tokval(parser), parser->blocklocal))) {
                 ast_value_delete(var);
                 parseerror(parser, "local %s already declared here: %s:%i\n",
                            parser_tokval(parser), ast_ctx(olddecl).file, (int)ast_ctx(olddecl).line);