diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index 2a287a1816fe..dedb08764527 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -234,7 +234,7 @@ class GDExtensionMethodBind : public MethodBind { void *ret_opaque = nullptr; if (r_ret) { VariantInternal::initialize(r_ret, return_value_info.type); - ret_opaque = VariantInternal::get_opaque_pointer(r_ret); + ret_opaque = r_ret->get_type() == Variant::NIL ? r_ret : VariantInternal::get_opaque_pointer(r_ret); } ptrcall(p_object, argptrs, ret_opaque);