summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r--modules/gdscript/gdscript_function.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index a01a7397fe..eef39da8b5 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -500,6 +500,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
Object *obj_A = *a;
Object *obj_B = *b;
+#ifdef DEBUG_ENABLED
+ if (!ObjectDB::instance_validate(obj_A)) {
+ err_text = "Left operand of 'is' was already freed.";
+ OPCODE_BREAK;
+ }
+#endif // DEBUG_ENABLED
+
GDScript *scr_B = Object::cast_to<GDScript>(obj_B);
if (scr_B) {