Skip to content

Commit 62c5064

Browse files
committed
don't panic of logs don't exist
1 parent 7726887 commit 62c5064

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

Signal-Windows.Lib/SignalLogging.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,23 @@ public static void ExportUILog(StorageFile file)
174174
{
175175
lock(Lock)
176176
{
177-
var oldLog = File.OpenRead(ApplicationData.Current.LocalCacheFolder.Path + @"\Signal-Windows.ui.log.old");
178-
var newLog = File.OpenRead(ApplicationData.Current.LocalCacheFolder.Path + @"\Signal-Windows.ui.log");
179177
FileIO.WriteTextAsync(file, "").AsTask().Wait();
180178
CachedFileManager.DeferUpdates(file);
181179
var writer = file.OpenStreamForWriteAsync().Result;
182-
MoveFileContent(oldLog, writer);
183-
MoveFileContent(newLog, writer);
180+
try
181+
{
182+
var oldLog = File.OpenRead(ApplicationData.Current.LocalCacheFolder.Path + @"\Signal-Windows.ui.log.old");
183+
MoveFileContent(oldLog, writer);
184+
oldLog.Dispose();
185+
} catch (Exception e) { }
186+
try
187+
{
188+
var newLog = File.OpenRead(ApplicationData.Current.LocalCacheFolder.Path + @"\Signal-Windows.ui.log");
189+
MoveFileContent(newLog, writer);
190+
newLog.Dispose();
191+
}
192+
catch (Exception e) { }
184193
Windows.Storage.Provider.FileUpdateStatus status = CachedFileManager.CompleteUpdatesAsync(file).AsTask().Result;
185-
oldLog.Dispose();
186-
newLog.Dispose();
187194
}
188195
}
189196

0 commit comments

Comments
 (0)