Merge pull request #87331 from KoBeWi/you_can_ref_count_on_that

Simplify RefCounted check in `free()`
This commit is contained in:
Rémi Verschelde 2024-01-18 16:35:38 +01:00
commit 266ae93291
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -728,7 +728,7 @@ Variant Object::callp(const StringName &p_method, const Variant **p_args, int p_
r_error.expected = 0; r_error.expected = 0;
return Variant(); return Variant();
} }
if (Object::cast_to<RefCounted>(this)) { if (is_ref_counted()) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
ERR_FAIL_V_MSG(Variant(), "Can't 'free' a reference."); ERR_FAIL_V_MSG(Variant(), "Can't 'free' a reference.");
} }