C#: Add null check before calling UnregisterGodotObject

(cherry picked from commit 693e6e036b)
This commit is contained in:
RedworkDE 2023-07-07 13:09:40 +02:00 committed by Yuri Sizov
parent 6018ff49d6
commit 69948f7489

View File

@ -125,7 +125,10 @@ namespace Godot
NativePtr = IntPtr.Zero; NativePtr = IntPtr.Zero;
} }
DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf); if (_weakReferenceToSelf != null)
{
DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf);
}
} }
/// <summary> /// <summary>