浏览代码

Fixed infinite loop when node type of node view model could not be determined

CPKreuz 1 年之前
父节点
当前提交
d3ccca69df
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/PixiEditor/ViewModels/Nodes/NodeTypeInfo.cs

+ 3 - 1
src/PixiEditor/ViewModels/Nodes/NodeTypeInfo.cs

@@ -41,7 +41,7 @@ public class NodeTypeInfo
 
     private Type GetNodeType(Type? baseType)
     {
-        while (true)
+        while (baseType != null)
         {
             if (baseType.IsGenericType)
             {
@@ -55,5 +55,7 @@ public class NodeTypeInfo
 
             baseType = baseType.BaseType;
         }
+
+        throw new NullReferenceException($"Could not find node type of '{baseType}' in base classes");
     }
 }