diff --git a/include/godot_cpp/classes/ref.hpp b/include/godot_cpp/classes/ref.hpp index 137b677b..8511fe4c 100644 --- a/include/godot_cpp/classes/ref.hpp +++ b/include/godot_cpp/classes/ref.hpp @@ -230,7 +230,9 @@ template struct PtrToArg> { _FORCE_INLINE_ static Ref convert(const void *p_ptr) { GDExtensionRefPtr ref = (GDExtensionRefPtr)p_ptr; - ERR_FAIL_NULL_V(p_ptr, Ref()); + if (unlikely(!p_ptr)) { + return Ref(); + } return Ref(reinterpret_cast(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref)))); } @@ -254,7 +256,9 @@ struct PtrToArg &> { _FORCE_INLINE_ static Ref convert(const void *p_ptr) { GDExtensionRefPtr ref = const_cast(p_ptr); - ERR_FAIL_NULL_V(p_ptr, Ref()); + if (unlikely(!p_ptr)) { + return Ref(); + } return Ref(reinterpret_cast(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref)))); } };