diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-04-27 11:56:39 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-04-27 16:22:57 +0200 |
commit | 31e7ee63f21e7b86d41cdb724824d4dc0804f281 (patch) | |
tree | cd7146d05bd3ac5069083a1ca499f6662c4971b5 /core/object/object.cpp | |
parent | 6118592c6d88350d01f74faff6fd49754f84a7d0 (diff) | |
download | redot-engine-31e7ee63f21e7b86d41cdb724824d4dc0804f281.tar.gz |
Fix unsafe uses of `Callable.is_null()`
`Callable.is_null()` is not equivalent to `!Callable.is_valid()` and
doesn't guarantee the call is valid.
Diffstat (limited to 'core/object/object.cpp')
-rw-r--r-- | core/object/object.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp index f8d2feb5a8..30629ba205 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -1455,7 +1455,7 @@ Error Object::connect(const StringName &p_signal, const Callable &p_callable, ui } bool Object::is_connected(const StringName &p_signal, const Callable &p_callable) const { - ERR_FAIL_COND_V_MSG(p_callable.is_null(), false, "Cannot determine if connected to '" + p_signal + "': the provided callable is null."); + ERR_FAIL_COND_V_MSG(p_callable.is_null(), false, "Cannot determine if connected to '" + p_signal + "': the provided callable is null."); // Should use `is_null`, see note in `connect` about the use of `is_valid`. const SignalData *s = signal_map.getptr(p_signal); if (!s) { bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal); @@ -1478,7 +1478,7 @@ void Object::disconnect(const StringName &p_signal, const Callable &p_callable) } bool Object::_disconnect(const StringName &p_signal, const Callable &p_callable, bool p_force) { - ERR_FAIL_COND_V_MSG(p_callable.is_null(), false, "Cannot disconnect from '" + p_signal + "': the provided callable is null."); + ERR_FAIL_COND_V_MSG(p_callable.is_null(), false, "Cannot disconnect from '" + p_signal + "': the provided callable is null."); // Should use `is_null`, see note in `connect` about the use of `is_valid`. SignalData *s = signal_map.getptr(p_signal); if (!s) { |