From c71a6c6d71e6dc8dc0d6fe20c77ea2de612a9836 Mon Sep 17 00:00:00 2001 From: lonesurvivor Date: Sat, 4 Feb 2017 20:51:56 +0100 Subject: Fix parsing bug which causes range(variable) to crash the engine problem was a segmentation fault caused by trying to access Vector constants[0] which isn't there if op->arguments.size() is not bigger than one. - the changed OR condition didn't make sense (always true), should be AND - changes the "constant" variable to be false per default and gets set to true when there is actually something pushed to "constants" --- modules/gdscript/gd_parser.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 34c39c8024..c1c1f5d5a9 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2577,7 +2577,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { Vector args; Vector constants; - bool constant=true; + bool constant=false; for(int i=1;iarguments.size();i++) { args.push_back(op->arguments[i]); @@ -2585,13 +2585,12 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { ConstantNode *c = static_cast(op->arguments[i]); if (c->value.get_type()==Variant::REAL || c->value.get_type()==Variant::INT) { constants.push_back(c->value); - } else { - constant=false; + constant=true; } } } - if (args.size()>0 || args.size()<4) { + if (args.size()>0 && args.size()<4) { if (constant) { -- cgit v1.2.3