From 2dd1d2ac56f713a2dbf426329ea0951ad4c8ed3e Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Tue, 26 Sep 2023 17:41:32 +0200 Subject: [PATCH] Fix possible crash --- Shared/Navigation/Sidebar.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Shared/Navigation/Sidebar.swift b/Shared/Navigation/Sidebar.swift index 29ce7dc7..a2b3a712 100644 --- a/Shared/Navigation/Sidebar.swift +++ b/Shared/Navigation/Sidebar.swift @@ -35,7 +35,9 @@ struct Sidebar: View { } } .onChange(of: navigation.sidebarSectionChanged) { _ in - scrollScrollViewToItem(scrollView: scrollView, for: navigation.tabSelection) + if let tabSelection = navigation.tabSelection { + scrollScrollViewToItem(scrollView: scrollView, for: navigation.tabSelection) + } } .listStyle(.sidebar) }