summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlexander Schill <alexander@schillnet.de>2022-10-11 09:22:52 +0200
committerAlexander Schill <alexander@schillnet.de>2022-10-13 00:19:46 +0200
commit5f47873f1064defc0f2c3ad7163812a19f58d707 (patch)
treed4a333fc1dbdb09982edde8cfe733374f807b2f7 /modules
parent28f642097a7986867e4fb7d697764efb4db753bf (diff)
Adding null check to prevent null reference exception when serializing delegates in C#
Diffstat (limited to 'modules')
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs
index 3c75d18943..9b3969d453 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs
@@ -76,6 +76,11 @@ namespace Godot
internal static bool TrySerializeDelegate(Delegate @delegate, Collections.Array serializedData)
{
+ if (@delegate is null)
+ {
+ return false;
+ }
+
if (@delegate is MulticastDelegate multicastDelegate)
{
bool someDelegatesSerialized = false;