Throw error when trying to emit a non-existing signal.

closes #6017

(cherry picked from commit 276087e92d)
This commit is contained in:
Andreas Haas 2016-09-25 19:21:21 +02:00 committed by Rémi Verschelde
parent a827734e03
commit 5adb75c2e7
1 changed files with 9 additions and 0 deletions

View File

@ -1152,6 +1152,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;
}