From ef16642c044bc1721425ae2a5f0cd65a4baa2808 Mon Sep 17 00:00:00 2001 From: estrogen elf <87099578+BlossomiShymae@users.noreply.github.com> Date: Thu, 29 May 2025 15:32:24 -0500 Subject: [PATCH] fix: prevent closing only tab --- .../Views/Pages/Endpoints/EndpointsTabView.axaml.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Needlework.Net/Views/Pages/Endpoints/EndpointsTabView.axaml.cs b/Needlework.Net/Views/Pages/Endpoints/EndpointsTabView.axaml.cs index 9c910d9..980961a 100644 --- a/Needlework.Net/Views/Pages/Endpoints/EndpointsTabView.axaml.cs +++ b/Needlework.Net/Views/Pages/Endpoints/EndpointsTabView.axaml.cs @@ -13,7 +13,12 @@ public partial class EndpointsTabView : UserControl private void TabView_TabCloseRequested(FluentAvalonia.UI.Controls.TabView sender, FluentAvalonia.UI.Controls.TabViewTabCloseRequestedEventArgs args) { - if (args.Tab.Content is EndpointItem item) - ((IList)sender.TabItems).Remove(item); + if (args.Tab.Content is EndpointItem item && sender.TabItems is IList tabItems) + { + if (tabItems.Count > 1) + { + tabItems.Remove(item); + } + } } } \ No newline at end of file