From 7f02301a91d3cb6688e510a89bc13550d956df0d Mon Sep 17 00:00:00 2001 From: David Snopek Date: Mon, 7 Oct 2024 11:22:52 -0500 Subject: [PATCH] Don't print an error when decoding a null Ref --- include/godot_cpp/classes/ref.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/godot_cpp/classes/ref.hpp b/include/godot_cpp/classes/ref.hpp index 137b677bf..8511fe4c2 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)))); } };