Merge pull request #2865 from hurikhan/pr_fix_2791
Added additional token checks for the shader if..else.. statement.
This commit is contained in:
commit
38ab47d2f9
1 changed files with 11 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue