From: Dale Weiler Date: Sat, 5 May 2018 19:38:12 +0000 (-0400) Subject: error if a function is called from global scope opposed to crashing X-Git-Tag: xonotic-v0.8.5~22 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=9a21c638fab848862c5c421f2f80c331d56dda3d;ds=sidebyside error if a function is called from global scope opposed to crashing --- diff --git a/parser.cpp b/parser.cpp index c795e40..cc2b358 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1188,6 +1188,12 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy) static bool parser_close_call(parser_t *parser, shunt *sy) { + if (!parser->function) + { + parseerror(parser, "cannot call functions from global scope"); + return false; + } + /* was a function call */ ast_expression *fun; ast_value *funval = nullptr;