Expression before 'is' may be null

This commit is contained in:
Cameron Reikes 2019-08-08 21:52:27 -07:00
parent fe3cd51755
commit 2339e85b78
1 changed files with 4 additions and 0 deletions

View File

@ -898,6 +898,10 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_IS && tokenizer->get_token(1) == GDScriptTokenizer::TK_BUILT_IN_TYPE) { } else if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_IS && tokenizer->get_token(1) == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
// 'is' operator with built-in type // 'is' operator with built-in type
if (!expr) {
_set_error("Expected identifier before 'is' operator");
return NULL;
}
OperatorNode *op = alloc_node<OperatorNode>(); OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_IS_BUILTIN; op->op = OperatorNode::OP_IS_BUILTIN;
op->arguments.push_back(expr); op->arguments.push_back(expr);