Skip to content

Commit c8c09ef

Browse files
authored
Merge pull request #104 from Toastbrot236/icon-loading-catch
Catch and log exceptions while trying to load refresher.ico in RefresherForm
2 parents 2a3f961 + a14c223 commit c8c09ef

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Refresher.Core/LogType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ public enum LogType : byte
2222
Encrypt,
2323
Decrypt,
2424
Platform,
25+
RefresherForm,
2526
}

Refresher/UI/RefresherForm.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ protected RefresherForm(string subtitle, Size size, bool padBottom = true)
1818
// this.AutoSize = true;
1919
this.Padding = new Padding(10, 10, 10, padBottom ? 10 : 0);
2020

21-
this.Icon = Icon.FromResource("refresher.ico");
21+
try
22+
{
23+
this.Icon = Icon.FromResource("refresher.ico");
24+
}
25+
catch (Exception ex)
26+
{
27+
// Not very important, so this should just be a warning, not an error
28+
State.Logger.LogWarning(LogType.RefresherForm, $"Unhandled exception while loading refresher.ico in {this.GetType()}: {ex}");
29+
}
2230

2331
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
2432
Menu = new RefresherMenuBar();

0 commit comments

Comments
 (0)