Browse Source

Merge pull request #895 from PixiEditor/fixes/always-send-exception_open-from-report

Don't always send a exception on FileViewModel.OpenFromReport(...)
Krzysztof Krysiński 4 months ago
parent
commit
7431b182a8
1 changed files with 11 additions and 6 deletions
  1. 11 6
      src/PixiEditor/ViewModels/SubViewModels/FileViewModel.cs

+ 11 - 6
src/PixiEditor/ViewModels/SubViewModels/FileViewModel.cs

@@ -405,12 +405,12 @@ internal class FileViewModel : SubViewModel<ViewModelMain>
 
         var i = 0;
 
-        Exception firstException = null;
-        Exception secondException = null;
-        Exception thirdException = null;
-
         foreach (var document in documents)
         {
+            Exception firstException = null;
+            Exception secondException = null;
+            Exception thirdException = null;
+
             try
             {
                 OpenRecoveredDotPixi(document.OriginalPath, document.AutosavePath,
@@ -441,8 +441,13 @@ internal class FileViewModel : SubViewModel<ViewModelMain>
                 }
             }
 
-            var exceptions = new[] { firstException, secondException, thirdException };
-            CrashHelper.SendExceptionInfo(new AggregateException(exceptions.Where(x => x != null).ToArray()));
+            var exceptions = new[] { firstException, secondException, thirdException }
+                .Where(x => x != null).ToArray();
+
+            if (exceptions.Length > 0)
+            {
+                CrashHelper.SendExceptionInfo(new AggregateException(exceptions));
+            }
         }
 
         showMissingFilesDialog = documents.Count != i;