Crash when switching library sections
Steps to reproduce:
- create an empty library and index a folder without any TV episodes
- expand "Videos" on the left
- go down with the arrow keys to show the empty "Shows"
- go back up with the arrow keys to go to "Videos"
- boom.
Exception Name: NSRangeException
Description: *** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty array
User Info: (null)
0 CoreFoundation 0x000000018464e2cc __exceptionPreprocess + 176
1 libobjc.A.dylib 0x0000000184132158 objc_exception_throw + 60
2 CoreFoundation 0x0000000184677378 CFArrayApply + 0
3 libmacosx_plugin.dylib 0x00000001056dc5c4 -[VLCLibraryAbstractGroupingDataSource numberOfRowsInTableView:] + 364
4 AppKit 0x0000000187ed643c -[NSTableView _uncachedNumberOfRows] + 180
5 AppKit 0x000000018898a8f8 -[NSTableRowHeightData numberOfRows] + 48
6 AppKit 0x0000000187eba304 -[NSTableView _verifySelectionIsOK] + 132
7 AppKit 0x0000000187eb7490 -[NSTableView _tileAndRedisplayAll] + 208
8 libmacosx_plugin.dylib 0x00000001056faaa4 -[VLCLibraryMasterDetailViewTableViewDelegate tableViewSelectionDidChange:] + 536
9 CoreFoundation 0x00000001845ce124 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
10 CoreFoundation 0x00000001846623b8 ___CFXRegistrationPost_block_invoke + 88
11 CoreFoundation 0x0000000184662300 _CFXRegistrationPost + 440
12 CoreFoundation 0x000000018459c658 _CFXNotificationPost + 768
13 Foundation 0x00000001856b92c4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
14 AppKit 0x0000000187f28274 -[NSTableView _sendSelectionChangedNotificationForRows:columns:] + 200
15 AppKit 0x0000000187eba5d4 -[NSTableView _verifySelectionIsOK] + 852
16 AppKit 0x0000000187eb7490 -[NSTableView _tileAndRedisplayAll] + 208
17 AppKit 0x0000000187ed6aa8 -[NSTableView setDataSource:] + 400
18 libmacosx_plugin.dylib 0x00000001057343f8 -[VLCLibraryVideoViewController updatePresentedVideoLibraryView] + 200
19 libmacosx_plugin.dylib 0x0000000105734b58 -[VLCLibraryVideoViewController presentVideoView] + 36
20 libmacosx_plugin.dylib 0x0000000105710e44 -[VLCLibraryWindow showVideoLibrary] + 116
21 libmacosx_plugin.dylib 0x0000000105710828 -[VLCLibraryWindow setViewForSelectedSegment] + 124
22 libmacosx_plugin.dylib 0x0000000105710990 -[VLCLibraryWindow setLibrarySegmentType:] + 100
23 libmacosx_plugin.dylib 0x000000010571b360 -[VLCLibraryWindowNavigationSidebarViewController outlineViewSelectionDidChange:] + 604
24 CoreFoundation 0x00000001845ce124 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
25 CoreFoundation 0x00000001846623b8 ___CFXRegistrationPost_block_invoke + 88
26 CoreFoundation 0x0000000184662300 _CFXRegistrationPost + 440
27 CoreFoundation 0x000000018459c658 _CFXNotificationPost + 768
28 Foundation 0x00000001856b92c4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
29 AppKit 0x0000000187f28274 -[NSTableView _sendSelectionChangedNotificationForRows:columns:] + 200
30 AppKit 0x00000001887ddaa8 -[NSTableView _selectRowsGoingUp:extendSelection:jumpToFirstOrLast:] + 1412
31 AppKit 0x00000001887dd4e4 -[NSTableView _selectRowsFromArrowKey:withEvent:] + 100
32 AppKit 0x0000000188108020 -[NSTableView keyDown:] + 172
33 AppKit 0x000000018855b810 -[NSOutlineView keyDown:] + 128
34 AppKit 0x0000000187f63578 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 404
35 AppKit 0x0000000187f63210 -[NSWindow(NSEventRouting) sendEvent:] + 284
36 AppKit 0x000000018862c4f0 -[NSApplication(NSEventRouting) sendEvent:] + 1604
37 AppKit 0x0000000188279d9c -[NSApplication _handleEvent:] + 60
38 AppKit 0x0000000187e2a020 -[NSApplication run] + 512
39 libmacosx_plugin.dylib 0x000000010575e3bc __OpenIntf_block_invoke + 852
40 CoreFoundation 0x00000001845d9050 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28
41 CoreFoundation 0x00000001845d8f64 __CFRunLoopDoBlocks + 356
42 CoreFoundation 0x00000001845d83f4 __CFRunLoopRun + 2440
43 CoreFoundation 0x00000001845d7414 CFRunLoopRunSpecific + 608
44 CoreFoundation 0x000000018465543c CFRunLoopRun + 64
45 vlc-osx-static 0x000000010492ec80 main + 1944
46 dyld 0x000000018416f154 start + 2476