Improve handling of exceptions thrown in `Form.Load` handlers

obviously only benefits forms inheriting `FormBase`
This commit is contained in:
YoshiRulz 2022-12-02 03:48:16 +10:00
parent 9393e1b764
commit 3dcc3ff89f
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 11 additions and 1 deletions

View File

@ -66,7 +66,17 @@ namespace BizHawk.Client.EmuHawk
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
base.OnLoad(e);
}
catch (Exception ex)
{
using ExceptionBox box = new(ex);
box.ShowDialog(owner: this);
Close();
return;
}
if (OSTailoredCode.IsUnixHost) FixBackColorOnControls(this);
UpdateWindowTitle();
}