Explorar o código

Fix crash when is-operator right-hand-side is null

(cherry picked from commit 871a73341b0eedf1ee9164988c5bb9dd0b57a659)
Haoyu Qiu %!s(int64=3) %!d(string=hai) anos
pai
achega
c594e1c0cc
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      modules/gdscript/gdscript_function.cpp

+ 5 - 1
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