Browse Source

Merge pull request #67216 from dotlogix/Bugfix/FixErrorWhenSerializingSignals

Fix crash when serializing empty delegates in C#
Rémi Verschelde 2 years ago
parent
commit
b9e924c806
1 changed files with 5 additions and 0 deletions
  1. 5 0
      modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs

+ 5 - 0
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;