summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-17 23:15:20 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-17 23:15:20 +0100
commitb48dd1bdafae18d8a14152795062c0e7e9ad9435 (patch)
tree82742fbd2a561f688200612010617d8ad8912fa8 /modules/mono/csharp_script.cpp
parent9c1768836f25e780a7ef51a1d18a0a15e0b55e42 (diff)
downloadredot-engine-b48dd1bdafae18d8a14152795062c0e7e9ad9435.tar.gz
C#: Fix crash due to missing gchandle ref null check
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 1b2ba58d22..13f8385745 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1189,7 +1189,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
return refcount == 0;
Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
- if (refcount == 1 && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
+ if (refcount == 1 && gchandle.is_valid() && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
// If owner owner is no longer referenced by the unmanaged side,
// the managed instance takes responsibility of deleting the owner when GCed.