Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions Flow.Launcher/ReportWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,20 @@

private void SetException(Exception exception)
{
var path = DataLocation.VersionLogDirectory;
var directory = new DirectoryInfo(path);
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First();
FileInfo log = null;
try
{
var path = DataLocation.VersionLogDirectory;
var directory = new DirectoryInfo(path);
if (directory.Exists)
{
log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).FirstOrDefault();
}
}
catch (Exception)
{
// Ignore IO errors when trying to find the log file
Comment thread
Jack251970 marked this conversation as resolved.
Outdated
}

var websiteUrl = exception switch
{
Expand All @@ -49,8 +60,11 @@
};

var paragraph = Hyperlink(Localize.reportWindow_please_open_issue(), websiteUrl);
paragraph.Inlines.Add(Localize.reportWindow_upload_log(log.FullName));
paragraph.Inlines.Add("\n");
if (log is not null)
{
paragraph.Inlines.Add(Localize.reportWindow_upload_log(log.FullName));
paragraph.Inlines.Add("\n");
}
paragraph.Inlines.Add(Localize.reportWindow_copy_below());
ErrorTextbox.Document.Blocks.Add(paragraph);

Expand Down Expand Up @@ -100,7 +114,7 @@
}
else
{
// Add the hyperlink if it is valid

Check warning on line 117 in Flow.Launcher/ReportWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`hyperlink` is not a recognized word. (unrecognized-spelling)
paragraph.Inlines.Add(link);
}
paragraph.Inlines.Add("\n");
Expand Down
Loading