From c2fc5b10e76c4c479438dcde8fe263ebbf6e0ec5 Mon Sep 17 00:00:00 2001 From: lrucker1 Date: Sat, 4 Feb 2023 13:34:53 -0800 Subject: [PATCH] Update FixedSidebarSplitViewController.m There's a bug in the superclass; it doesn't check the splitViewItems count and so it'll crash with an array range error if autolayout happens before viewDidLoad. This could happen if your window has a toolbar. Filed FB11980648 with Apple, meanwhile here's a workaround. --- SplitViewSidebar/FixedSidebarSplitViewController.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SplitViewSidebar/FixedSidebarSplitViewController.m b/SplitViewSidebar/FixedSidebarSplitViewController.m index 5a50bc5..4d102a6 100644 --- a/SplitViewSidebar/FixedSidebarSplitViewController.m +++ b/SplitViewSidebar/FixedSidebarSplitViewController.m @@ -83,5 +83,14 @@ - (IBAction)collapseSidebar:(id)sender { */ +// There's a bug in the superclass; it doesn't check the splitViewItems count and so it'll crash if autolayout happens before viewDidLoad. This could happen if your window has a toolbar. +- (BOOL)splitView:(NSSplitView *)splitView +shouldHideDividerAtIndex:(NSInteger)dividerIndex { + if ([self.splitViewItems count] == 0) { + return NO; + } + return [super splitView:splitView shouldHideDividerAtIndex:dividerIndex]; +} + @end