From 871a73341b0eedf1ee9164988c5bb9dd0b57a659 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 13 Mar 2022 23:17:25 +0800 Subject: [PATCH] Fix crash when is-operator right-hand-side is null --- modules/gdscript/gdscript_function.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 850d75aa8eb..40a2466ed92 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -509,7 +509,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #ifdef DEBUG_ENABLED if (!nc) { - err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "')."; + if (obj_B) { + err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "')."; + } else { + err_text = "Right operand of 'is' is null."; + } OPCODE_BREAK; } #endif