mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 14:12:36 +00:00
fix: check if parsing a variable initializer failed
This commit is contained in:
parent
fe2f9d79c5
commit
5022f716dc
1 changed files with 5 additions and 0 deletions
5
parser.c
5
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");
|
||||
|
|
Loading…
Reference in a new issue