소스 검색

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 6 달 전
부모
커밋
7431b182a8
1개의 변경된 파일11개의 추가작업 그리고 6개의 파일을 삭제
  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;