From 8160521d102bc3713bcce6fbd351b99b7d1cc244 Mon Sep 17 00:00:00 2001 From: Nikolay Kuznetsov Date: Fri, 16 Jul 2021 01:57:13 +0200 Subject: [PATCH] Add a bit of exception handling to headpats/hugs buttons --- VRCMelonAssistant/Pages/About.xaml.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/VRCMelonAssistant/Pages/About.xaml.cs b/VRCMelonAssistant/Pages/About.xaml.cs index 0bf5bd7..0973da9 100644 --- a/VRCMelonAssistant/Pages/About.xaml.cs +++ b/VRCMelonAssistant/Pages/About.xaml.cs @@ -1,3 +1,4 @@ +using System; using System.Diagnostics; using System.Threading.Tasks; using System.Windows; @@ -50,12 +51,32 @@ namespace VRCMelonAssistant.Pages private async Task HeadPat() { - PatImage.Load(await WeebCDN("pats")); + try + { + PatImage.Load(await WeebCDN("pats")); + } + catch (Exception ex) + { + Application.Current.Dispatcher.Invoke(() => + { + Utils.ShowErrorMessageBox("Oops! Can't get headpats right now!", ex); + }); + } } private async Task Hug() { - HugImage.Load(await WeebCDN("hugs")); + try + { + HugImage.Load(await WeebCDN("hugs")); + } + catch (Exception ex) + { + Application.Current.Dispatcher.Invoke(() => + { + Utils.ShowErrorMessageBox("Oops! Can't get hugs right now!", ex); + }); + } } } }