Parcourir la source

Added exception for when node view model could not be found

CPKreuz il y a 1 an
Parent
commit
ede7f32f42
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      src/PixiEditor/Models/DocumentModels/DocumentUpdater.cs

+ 3 - 0
src/PixiEditor/Models/DocumentModels/DocumentUpdater.cs

@@ -513,6 +513,9 @@ internal class DocumentUpdater
         var name = nodeType.Name.Replace("Node", "NodeViewModel");
         var nodeViewModelType = Type.GetType($"{ns}.{name}");
 
+        if (nodeViewModelType == null)
+            throw new NullReferenceException($"No ViewModel found for {nodeType}. Looking for {name}");
+        
         var viewModel = (NodeViewModel)Activator.CreateInstance(nodeViewModelType);
 
         InitializeNodeViewModel(info, viewModel);