Browse Source

Only assign active document if there are documents

CPKreuz 4 years ago
parent
commit
a5fe9ccd6b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      PixiEditor/ViewModels/SubViewModels/Main/FileViewModel.cs

+ 5 - 1
PixiEditor/ViewModels/SubViewModels/Main/FileViewModel.cs

@@ -154,7 +154,11 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
                 if (Importer.IsSupportedFile(dialog.FileName))
                 {
                     Open(dialog.FileName);
-                    Owner.BitmapManager.ActiveDocument = Owner.BitmapManager.Documents.Last();
+
+                    if (Owner.BitmapManager.Documents.Count > 0)
+                    {
+                        Owner.BitmapManager.ActiveDocument = Owner.BitmapManager.Documents.Last();
+                    }
                 }
             }
         }