Skip to content

Commit

Permalink
Don't print an error when decoding a null Ref<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnopek committed Oct 7, 2024
1 parent 6facde3 commit 7f02301
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/godot_cpp/classes/ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ template <typename T>
struct PtrToArg<Ref<T>> {
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
GDExtensionRefPtr ref = (GDExtensionRefPtr)p_ptr;
ERR_FAIL_NULL_V(p_ptr, Ref<T>());
if (unlikely(!p_ptr)) {
return Ref<T>();
}
return Ref<T>(reinterpret_cast<T *>(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref))));
}

Expand All @@ -254,7 +256,9 @@ struct PtrToArg<const Ref<T> &> {

_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
GDExtensionRefPtr ref = const_cast<GDExtensionRefPtr>(p_ptr);
ERR_FAIL_NULL_V(p_ptr, Ref<T>());
if (unlikely(!p_ptr)) {
return Ref<T>();
}
return Ref<T>(reinterpret_cast<T *>(godot::internal::get_object_instance_binding(godot::internal::gdextension_interface_ref_get_object(ref))));
}
};
Expand Down

0 comments on commit 7f02301

Please sign in to comment.