1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

GDSript: Prevent crash when completing unary operators

This commit is contained in:
George Marques
2020-08-17 20:49:04 -03:00
parent 9ecd042e78
commit f374021d52

View File

@@ -2509,6 +2509,12 @@ void GDScriptAnalyzer::reduce_unary_op(GDScriptParser::UnaryOpNode *p_unary_op)
GDScriptParser::DataType result;
if (p_unary_op->operand == nullptr) {
result.kind = GDScriptParser::DataType::VARIANT;
p_unary_op->set_datatype(result);
return;
}
if (p_unary_op->operand->is_constant) {
p_unary_op->is_constant = true;
p_unary_op->reduced_value = Variant::evaluate(p_unary_op->variant_op, p_unary_op->operand->reduced_value, Variant());