diff options
author | hurikhan <m4r10.5ch14ck@gmail.com> | 2015-11-22 13:49:58 +0800 |
---|---|---|
committer | hurikhan <m4r10.5ch14ck@gmail.com> | 2015-11-22 13:49:58 +0800 |
commit | 49f4ec2b71da7fe5d9e7d9fda8e9fb0bf3a7b711 (patch) | |
tree | b2c50dbe5fd994c3420bde9fd3d0ae26c80719aa /servers/visual | |
parent | 265f7ba4e529ad69295f2ae1558a7ea00a5aed6a (diff) |
Added additional token checks for the shader if..else.. statement. Fixes issue #2791.
Diffstat (limited to 'servers/visual')
-rw-r--r-- | servers/visual/shader_language.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 6532c3f0ac..8a2117c171 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2340,19 +2340,27 @@ Error ShaderLanguage::parse_flow_if(Parser& parser,Node *p_parent,Node **r_state parser.advance(); + if (parser.get_token_type()!=TK_CURLY_BRACKET_OPEN) { + parser.set_error("Expected statement block after 'if()'"); + return ERR_PARSE_ERROR; + } + Node *substatement=NULL; err = parse_statement(parser,cf,&substatement); if (err) return err; - cf->statements.push_back(substatement); - - if (parser.get_token_type()==TK_CF_ELSE) { parser.advance(); + + if (parser.get_token_type()!=TK_CURLY_BRACKET_OPEN) { + parser.set_error("Expected statement block after 'else'"); + return ERR_PARSE_ERROR; + } + substatement=NULL; err = parse_statement(parser,cf,&substatement); if (err) |