diff options
| author | RedworkDE <10944644+RedworkDE@users.noreply.github.com> | 2023-07-07 13:09:40 +0200 |
|---|---|---|
| committer | RedworkDE <10944644+RedworkDE@users.noreply.github.com> | 2023-07-07 13:10:16 +0200 |
| commit | 693e6e036b1428392b74dcfca2b0b5fe0fce66b5 (patch) | |
| tree | e326c52d5a8d7e5d0f208f13752b04b158803ee9 /modules/mono | |
| parent | 443820686cad24bbdd7e7050fa3d3f33f43a7bb5 (diff) | |
| download | redot-engine-693e6e036b1428392b74dcfca2b0b5fe0fce66b5.tar.gz | |
C#: Add null check before calling `UnregisterGodotObject`
Diffstat (limited to 'modules/mono')
| -rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs index b9a5ac82d1..12e8a638d3 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs @@ -125,7 +125,10 @@ namespace Godot NativePtr = IntPtr.Zero; } - DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf); + if (_weakReferenceToSelf != null) + { + DisposablesTracker.UnregisterGodotObject(this, _weakReferenceToSelf); + } } /// <summary> |
