From 3a1c7376c1e7642fa62a02ecb41e42cdbac1c48d Mon Sep 17 00:00:00 2001 From: estrogen elf <87099578+BlossomiShymae@users.noreply.github.com> Date: Mon, 25 May 2026 13:55:35 -0500 Subject: [PATCH] fix: exception when opening latest update --- .../MainWindow/NotificationViewModel.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Needlework.Net/ViewModels/MainWindow/NotificationViewModel.cs b/Needlework.Net/ViewModels/MainWindow/NotificationViewModel.cs index 1d2833e..ff58889 100644 --- a/Needlework.Net/ViewModels/MainWindow/NotificationViewModel.cs +++ b/Needlework.Net/ViewModels/MainWindow/NotificationViewModel.cs @@ -1,11 +1,12 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using Needlework.Net.Extensions; using Needlework.Net.Models; using System.Diagnostics; namespace Needlework.Net.ViewModels.MainWindow { - public partial class NotificationViewModel : ObservableObject + public partial class NotificationViewModel : ObservableObject, IEnableLogger { public NotificationViewModel(Notification notification) { @@ -20,8 +21,17 @@ namespace Needlework.Net.ViewModels.MainWindow [RelayCommand] public void OpenUrl() { - var process = new Process() { StartInfo = new() { UseShellExecute = true } }; - process.Start(); + try + { + var url = Notification?.Url ?? "https://github.com/BlossomiShymae/Needlework.Net/releases/latest"; + var process = new Process() { StartInfo = new(url) { UseShellExecute = true } }; + process.Start(); + } + catch (System.Exception exception) + { + this.Log() + .Error("Failed to open URL for notification: {@exception}", exception); + } } } }