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