summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-10-03 11:55:35 +0200
committerGitHub <noreply@github.com>2016-10-03 11:55:35 +0200
commit1dfa52ba59d6e6d9660e82202a77c2233b6f56e0 (patch)
treecdb981b13789b8871e1d92608e6a7c256bd6d521
parent463a42c71e0677560324acb8dca7672b2978badc (diff)
parent276087e92dd707d990565a373ab9f51a3a52ef2d (diff)
Merge pull request #6608 from Hinsbart/signal_err
Throw error when trying to emit a non-existing signal.
-rw-r--r--core/object.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/object.cpp b/core/object.cpp
index 8cd4e07097..9a1e9be8d5 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1215,6 +1215,15 @@ void Object::emit_signal(const StringName& p_name,const Variant** p_args,int p_a
Signal *s = signal_map.getptr(p_name);
if (!s) {
+#ifdef DEBUG_ENABLED
+ bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_name);
+ //check in script
+ if (!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)) {
+ ERR_EXPLAIN("Can't emit non-existing signal " + String("\"")+p_name+"\".");
+ ERR_FAIL();
+ }
+#endif
+ //not connected? just return
return;
}