From 8a42ab7a850a5d8f2e3ecc9768f59d8444cec609 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Fri, 14 Jan 2022 23:34:59 +0800 Subject: [PATCH] Fix crash when `is` keyword is tested against a String variable --- modules/gdscript/gdscript_function.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 5189fd294db..850d75aa8eb 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -473,7 +473,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a err_text = "Left operand of 'is' was already freed."; OPCODE_BREAK; } - if (b->is_invalid_object()) { + if (b->get_type() != Variant::OBJECT || b->is_invalid_object()) { err_text = "Right operand of 'is' is not a class."; OPCODE_BREAK; }