Skip to content

Commit 6a69ff2

Browse files
committed
[WIP] Fix method_bind_call when return is null
C# bindings pass a null pointer when the method returns void. So this change prevents a crash when the return pointer is null.
1 parent 55ab41d commit 6a69ff2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/extension/gdextension_interface.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,10 @@ static void gdextension_object_method_bind_call(GDExtensionMethodBindPtr p_metho
13331333
const Variant **args = (const Variant **)p_args;
13341334
Callable::CallError error;
13351335

1336-
memnew_placement(r_return, Variant(mb->call(o, args, p_arg_count, error)));
1336+
Variant ret = mb->call(o, args, p_arg_count, error);
1337+
if (r_return != nullptr) {
1338+
memnew_placement(r_return, Variant(ret));
1339+
}
13371340

13381341
if (r_error) {
13391342
r_error->error = (GDExtensionCallErrorType)(error.error);

0 commit comments

Comments
 (0)