summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-01-01 23:02:58 +0100
committerGitHub <noreply@github.com>2021-01-01 23:02:58 +0100
commitcc416b03045741b530d7f7b4d188128b51e49d03 (patch)
tree316496ccec83ab0c6056f1837aa9cb8d05513b2c /core
parent3433780c496e1c10a32356f2617c6533c358f16c (diff)
parent6c026a6814eb15c2832f9cfd30ee8ef8d0a236ab (diff)
Merge pull request #44848 from mrushyendra/disconnect_err_msg
Issue correct error when disconnecting nonexistent connection with a valid signal
Diffstat (limited to 'core')
-rw-r--r--core/object/object.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 3e2c9baf56..171bc4dc2c 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -1357,7 +1357,12 @@ void Object::_disconnect(const StringName &p_signal, const Callable &p_callable,
ERR_FAIL_COND(!target_object);
SignalData *s = signal_map.getptr(p_signal);
- ERR_FAIL_COND_MSG(!s, vformat("Nonexistent signal '%s' in %s.", p_signal, to_string()));
+ if (!s) {
+ bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal) ||
+ (!script.is_null() && Ref<Script>(script)->has_script_signal(p_signal));
+ ERR_FAIL_COND_MSG(signal_is_valid, "Attempt to disconnect a nonexistent connection from '" + to_string() + "'. signal: '" + p_signal + "', callable: '" + p_callable + "'.");
+ }
+ ERR_FAIL_COND_MSG(!s, vformat("Disconnecting nonexistent signal '%s' in %s.", p_signal, to_string()));
ERR_FAIL_COND_MSG(!s->slot_map.has(*p_callable.get_base_comparator()), "Disconnecting nonexistent signal '" + p_signal + "', callable: " + p_callable + ".");