From 5f47873f1064defc0f2c3ad7163812a19f58d707 Mon Sep 17 00:00:00 2001 From: Alexander Schill Date: Tue, 11 Oct 2022 09:22:52 +0200 Subject: [PATCH] Adding null check to prevent null reference exception when serializing delegates in C# --- .../mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs index 3c75d189438..9b3969d4530 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;