From 25242f796c633e0f2c156bd174dd46f49e8cd25b Mon Sep 17 00:00:00 2001 From: Jesse Cardone Date: Tue, 15 Oct 2024 16:14:54 -0700 Subject: [PATCH] Catch exceptions when loading avatars --- .../ConfirmationFormWeb.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Steam Desktop Authenticator/ConfirmationFormWeb.cs b/Steam Desktop Authenticator/ConfirmationFormWeb.cs index 2e3c4a52..5de1b96c 100644 --- a/Steam Desktop Authenticator/ConfirmationFormWeb.cs +++ b/Steam Desktop Authenticator/ConfirmationFormWeb.cs @@ -64,12 +64,19 @@ private async Task LoadData() e.Graphics.FillRectangle(brush, panel.ClientRectangle); } }; - + if (!string.IsNullOrEmpty(confirmation.Icon)) { - PictureBox pictureBox = new PictureBox() { Width = 60, Height = 60, Location = new Point(20, 20), SizeMode = PictureBoxSizeMode.Zoom }; - pictureBox.Load(confirmation.Icon); - panel.Controls.Add(pictureBox); + PictureBox pictureBox = new PictureBox() { Width = 60, Height = 60, Location = new Point(20, 20), SizeMode = PictureBoxSizeMode.Zoom }; + try + { + pictureBox.Load(confirmation.Icon); + } + catch (Exception ex) + { + Console.WriteLine("Failed to load avatar: " + ex.Message); + } + panel.Controls.Add(pictureBox); } Label nameLabel = new Label()