Merge pull request #33130 from Chaosus/fix_shader_crash

Fix shader crash if non-boolean expression inserted into "if"
This commit is contained in:
Rémi Verschelde 2019-10-28 08:38:46 +01:00 committed by GitHub
commit 5014baf34b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4143,6 +4143,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
if (!n)
return ERR_PARSE_ERROR;
if (n->get_datatype() != TYPE_BOOL) {
_set_error("Expected boolean expression");
return ERR_PARSE_ERROR;
}
tk = _get_token();
if (tk.type != TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')' after expression");