diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-07-07 16:05:28 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-07-07 16:05:28 +0200 |
commit | c3b0a92c3cd9a219c1b1776b48c147f1d0602f07 (patch) | |
tree | 77c923144890ee6ba912c40f06fe1a3549a765b9 /modules | |
parent | dcbbde5e235e611275d9972890c8993449ac0194 (diff) | |
parent | 693e6e036b1428392b74dcfca2b0b5fe0fce66b5 (diff) | |
download | redot-engine-c3b0a92c3cd9a219c1b1776b48c147f1d0602f07.tar.gz |
Merge pull request #79151 from RedworkDE/net-unregister-godotobject-check
C#: Add null check before calling `UnregisterGodotObject`
Diffstat (limited to 'modules')
-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> |