summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-10 07:40:56 +0100
committerGitHub <noreply@github.com>2020-01-10 07:40:56 +0100
commit09aa12a0dddde5a54a80ceb49ecfd25c5230495d (patch)
tree52d85fe13b84c8b34afe16835e519abe50bdd054 /modules/gdscript
parenta126bda47b89950b8586293823bbefc1f75adc40 (diff)
parent3718f8f5925bad0662d9ae84192d094b5da4d644 (diff)
Merge pull request #34958 from vnen/gdscript-is-check-valid-instance
GDScript: Validate object instance on `is` operation
Diffstat (limited to 'modules/gdscript')
-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) {