summaryrefslogtreecommitdiffstats
path: root/core/variant/callable.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-05-24 19:52:32 +0200
committerGitHub <noreply@github.com>2021-05-24 19:52:32 +0200
commit215e43242c2a5b2ec5a8ccb4d26d716f965cbbd9 (patch)
treee44aa26a8c2af357ab5f648e5de45ff73801be05 /core/variant/callable.cpp
parentc321f6ff4742d72e1863c69702ea6af47066965c (diff)
parentea44744e2daf512ac97ba7176d1e65d77b4f8042 (diff)
downloadredot-engine-215e43242c2a5b2ec5a8ccb4d26d716f965cbbd9.tar.gz
Merge pull request #49037 from vnen/fix-callable-freed-crash
Diffstat (limited to 'core/variant/callable.cpp')
-rw-r--r--core/variant/callable.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp
index e06b3e07ef..5c87042f6b 100644
--- a/core/variant/callable.cpp
+++ b/core/variant/callable.cpp
@@ -50,6 +50,15 @@ void Callable::call(const Variant **p_arguments, int p_argcount, Variant &r_retu
custom->call(p_arguments, p_argcount, r_return_value, r_call_error);
} else {
Object *obj = ObjectDB::get_instance(ObjectID(object));
+#ifdef DEBUG_ENABLED
+ if (!obj) {
+ r_call_error.error = CallError::CALL_ERROR_INSTANCE_IS_NULL;
+ r_call_error.argument = 0;
+ r_call_error.expected = 0;
+ r_return_value = Variant();
+ return;
+ }
+#endif
r_return_value = obj->call(method, p_arguments, p_argcount, r_call_error);
}
}