Skip to content

Commit

Permalink
Merge pull request godotengine#25078 from neikeq/mm-a
Browse files Browse the repository at this point in the history
C#: Fix crash due to missing gchandle ref null check
  • Loading branch information
neikeq authored Jan 18, 2019
2 parents 1efd37f + b48dd1b commit 938a251
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/mono/csharp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 938a251

Please sign in to comment.