소스 검색

Null check

Krzysztof Krysiński 3 달 전
부모
커밋
78d28ae327
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      src/PixiEditor.ChangeableDocument/Changeables/Graph/InputProperty.cs

+ 9 - 2
src/PixiEditor.ChangeableDocument/Changeables/Graph/InputProperty.cs

@@ -39,7 +39,14 @@ public class InputProperty : IInputProperty
 
 
             if (!ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is Delegate connectionField)
             if (!ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is Delegate connectionField)
             {
             {
-                return connectionField.DynamicInvoke(FuncContext.NoContext);
+                try
+                {
+                    return connectionField.DynamicInvoke(FuncContext.NoContext);
+                }
+                catch
+                {
+                    return null;
+                }
             }
             }
 
 
             if (ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is not Delegate)
             if (ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is not Delegate)
@@ -217,7 +224,7 @@ public class InputProperty : IInputProperty
         HashCode hash = new();
         HashCode hash = new();
         hash.Add(InternalPropertyName);
         hash.Add(InternalPropertyName);
         hash.Add(ValueType);
         hash.Add(ValueType);
-        if(Value is ICacheable cacheable)
+        if (Value is ICacheable cacheable)
         {
         {
             hash.Add(cacheable.GetCacheHash());
             hash.Add(cacheable.GetCacheHash());
         }
         }