Skip to content

Commit

Permalink
Merge pull request #79151 from RedworkDE/net-unregister-godotobject-c…
Browse files Browse the repository at this point in the history
…heck

C#: Add null check before calling `UnregisterGodotObject`
  • Loading branch information
akien-mga committed Jul 7, 2023
2 parents dcbbde5 + 693e6e0 commit c3b0a92
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ protected virtual void Dispose(bool disposing)
NativePtr = IntPtr.Zero;
}

DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf);
if (_weakReferenceToSelf != null)
{
DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf);
}
}

/// <summary>
Expand Down

0 comments on commit c3b0a92

Please sign in to comment.