summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd/gd_mono_marshal.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <neikeq@users.noreply.github.com>2019-02-19 15:05:05 +0100
committerGitHub <noreply@github.com>2019-02-19 15:05:05 +0100
commit1174d10e3c8f84e15dd6c5e795b5a6679c64c59c (patch)
treef39dd93c79173764c6a66763b94f55e5513e7b47 /modules/mono/mono_gd/gd_mono_marshal.cpp
parent2f9b7e6b6330888fca0b74dfe634a9c438f44dfb (diff)
parentb41a7935925a1f861f6230f8af5d91ef02c5c2d5 (diff)
Merge pull request #25890 from neikeq/issue-25818
Fix Godot.Reference marshalling from MonoObject* to Variant
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_marshal.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 74395de41c..18a49d0d1f 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -698,7 +698,11 @@ Variant mono_object_to_variant(MonoObject *p_obj) {
// GodotObject
if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj));
- return ptr ? Variant(ptr) : Variant();
+ if (ptr != NULL) {
+ Reference *ref = Object::cast_to<Reference>(ptr);
+ return ref ? Variant(Ref<Reference>(ref)) : Variant(ptr);
+ }
+ return Variant();
}
if (CACHED_CLASS(NodePath) == type_class) {