diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-12-08 17:09:58 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-12-08 17:09:58 -0300 |
commit | 38ab47d2f9547f73438e3cdb2752bd58e81634bf (patch) | |
tree | e2526991d28e2a5adef543f7fc00336d7caee316 | |
parent | ff936c6b2e79ffe9c93b855f417803c157fa4922 (diff) | |
parent | 49f4ec2b71da7fe5d9e7d9fda8e9fb0bf3a7b711 (diff) |
Merge pull request #2865 from hurikhan/pr_fix_2791
Added additional token checks for the shader if..else.. statement.
-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 68a60e26f5..0e10c7dfe4 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2341,19 +2341,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) |