macosx: Avoid crashing upon clicking collection view item when receiving nil index path
Data sources are able to return nil index paths for indexPathForLibraryItem
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: vlc-osx-static [20065]
Path: /Users/USER/Downloads/*/vlc-osx-static
Identifier: vlc-osx-static
Version: ???
Code Type: ARM-64 (Native)
Parent Process: zsh [1630]
Responsible: iTerm2 [1385]
User ID: 501
Date/Time: 2024-05-11 17:16:25.6986 +0800
OS Version: macOS 14.4.1 (23E224)
Report Version: 12
Anonymous UUID: 36C661B1-A848-29EE-3FBC-B141D36B1490
Sleep/Wake UUID: 95739C33-BE78-4152-B2C6-1D9884F1D359
Time Awake Since Boot: 7900 seconds
Time Since Wake: 3593 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: vlc-osx-static [20065]
Application Specific Information:
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x188deea60 __pthread_kill + 8
1 libsystem_pthread.dylib 0x188e26c20 pthread_kill + 288
2 libsystem_c.dylib 0x188d33a20 abort + 180
3 libc++abi.dylib 0x188dddd30 abort_message + 132
4 libc++abi.dylib 0x188dcdfe8 demangling_terminate_handler() + 348
5 libobjc.A.dylib 0x188a6c1d0 _objc_terminate() + 144
6 libc++abi.dylib 0x188ddd0f4 std::__terminate(void (*)()) + 16
7 libc++abi.dylib 0x188de0348 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 88
8 libc++abi.dylib 0x188de028c __cxa_throw + 308
9 libobjc.A.dylib 0x188a628f0 objc_exception_throw + 420
10 CoreFoundation 0x188e91c8c -[__NSPlaceholderSet initWithObjects:count:] + 616
11 CoreFoundation 0x188ee1658 __createSet + 48
12 CoreFoundation 0x188ee160c +[NSSet setWithObject:] + 32
13 libmacosx_plugin.dylib 0x102fe8988 -[VLCLibraryCollectionViewItem mouseDown:] + 768 (VLCLibraryCollectionViewItem.m:300)
14 AppKit 0x18c8f6f2c forwardMethod + 252
15 AppKit 0x18c8f6f2c forwardMethod + 252
16 AppKit 0x18c8f6f2c forwardMethod + 252
17 AppKit 0x18c8f6f2c forwardMethod + 252
18 AppKit 0x18c8fc99c -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3472
19 AppKit 0x18c887f78 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364
20 AppKit 0x18c887c38 -[NSWindow(NSEventRouting) sendEvent:] + 284
21 AppKit 0x18cf4de70 -[NSApplication(NSEventRouting) sendEvent:] + 1604
22 AppKit 0x18cb9b8cc -[NSApplication _handleEvent:] + 60
23 AppKit 0x18c74fcdc -[NSApplication run] + 512
24 vlc-osx-static 0x10038f2d4 main + 1780 (darwinvlc.m:294)
25 dyld 0x188a9e0e0 start + 2360
Thread 1:: vlc-exec-runner
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b64950 QueueTake + 168 (executor.c:98)
5 libvlccore.9.dylib 0x100b6477c ThreadRun + 76 (executor.c:128)
6 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
7 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 2:: vlc-exec-runner
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b64950 QueueTake + 168 (executor.c:98)
5 libvlccore.9.dylib 0x100b6477c ThreadRun + 76 (executor.c:128)
6 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
7 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 3:: vlc-exec-runner
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b64950 QueueTake + 168 (executor.c:98)
5 libvlccore.9.dylib 0x100b6477c ThreadRun + 76 (executor.c:128)
6 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
7 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 4:: vlc-exec-runner
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b64950 QueueTake + 168 (executor.c:98)
5 libvlccore.9.dylib 0x100b6477c ThreadRun + 76 (executor.c:128)
6 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
7 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 5:: vlc-exec-runner
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b64950 QueueTake + 168 (executor.c:98)
5 libvlccore.9.dylib 0x100b6477c ThreadRun + 76 (executor.c:128)
6 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
7 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 6:: caulk.messenger.shared:17
0 libsystem_kernel.dylib 0x188de6170 semaphore_wait_trap + 8
1 caulk 0x193397624 caulk::semaphore::timed_wait(double) + 212
2 caulk 0x1933974d8 caulk::concurrent::details::worker_thread::run() + 36
3 caulk 0x1933971d8 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*>>>(void*) + 96
4 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
5 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 7:: caulk.messenger.shared:high
0 libsystem_kernel.dylib 0x188de6170 semaphore_wait_trap + 8
1 caulk 0x193397624 caulk::semaphore::timed_wait(double) + 212
2 caulk 0x1933974d8 caulk::concurrent::details::worker_thread::run() + 36
3 caulk 0x1933971d8 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*>>>(void*) + 96
4 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
5 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 8:: vlc-player-end
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b057d0 vlc_player_destructor_Thread + 192 (player.c:199)
5 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
6 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 9:
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libc++.1.dylib 0x188d4cb14 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3 libmedialibrary_plugin.dylib 0x103b340c0 void std::__1::condition_variable::wait<medialibrary::ModificationNotifier::run()::$_1>(std::__1::unique_lock<std::__1::mutex>&, medialibrary::ModificationNotifier::run()::$_1) + 12 (__mutex_base:400) [inlined]
4 libmedialibrary_plugin.dylib 0x103b340c0 medialibrary::ModificationNotifier::run() + 1760 (ModificationsNotifier.cpp:268)
5 libmedialibrary_plugin.dylib 0x103b38d68 decltype(*std::declval<medialibrary::ModificationNotifier*>().*std::declval<void (medialibrary::ModificationNotifier::*)()>()()) std::__1::__invoke[abi:v160006]<void (medialibrary::ModificationNotifier::*)(), medialibrary::ModificationNotifier*, void>(void (medialibrary::ModificationNotifier::*&&)(), medialibrary::ModificationNotifier*&&) + 28 (invoke.h:359) [inlined]
6 libmedialibrary_plugin.dylib 0x103b38d68 void std::__1::__thread_execute[abi:v160006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (medialibrary::ModificationNotifier::*)(), medialibrary::ModificationNotifier*, 2ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (medialibrary::ModificationNotifier::*)(), medialibrary::ModificationNotifier*>&, std::__1::__tuple_indices<2ul>) + 28 (thread:288) [inlined]
7 libmedialibrary_plugin.dylib 0x103b38d68 void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (medialibrary::ModificationNotifier::*)(), medialibrary::ModificationNotifier*>>(void*) + 72 (thread:299)
8 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
9 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 10:: vlc-exec-runner
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b64950 QueueTake + 168 (executor.c:98)
5 libvlccore.9.dylib 0x100b6477c ThreadRun + 76 (executor.c:128)
6 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
7 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 11:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x188df1358 __select + 8
1 CoreFoundation 0x188f2f30c __CFSocketManager + 640
2 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
3 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 12:
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libupnp_plugin.dylib 0x102ed1930 TimerThreadWorker + 324 (TimerThread.c:131)
3 libupnp_plugin.dylib 0x102ed11a8 WorkerThread + 228 (ThreadPool.c:591)
4 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
5 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 13:
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libupnp_plugin.dylib 0x102ed14d0 WorkerThread + 1036 (ThreadPool.c:522)
3 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
4 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 14:
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libupnp_plugin.dylib 0x102ed14d0 WorkerThread + 1036 (ThreadPool.c:522)
3 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
4 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 15:
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libupnp_plugin.dylib 0x102ed14d0 WorkerThread + 1036 (ThreadPool.c:522)
3 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
4 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 16:
0 libsystem_kernel.dylib 0x188df1358 __select + 8
1 libupnp_plugin.dylib 0x102ec637c RunMiniServer + 848 (miniserver.c:660)
2 libupnp_plugin.dylib 0x102ed11a8 WorkerThread + 228 (ThreadPool.c:591)
3 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
4 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 17:
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libupnp_plugin.dylib 0x102ed14d0 WorkerThread + 1036 (ThreadPool.c:522)
3 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
4 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 18:: vlc-sap
0 libsystem_kernel.dylib 0x188deeb70 poll + 8
1 libsap_plugin.dylib 0x100921d10 Run + 896 (sap.c:571)
2 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
3 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 19:: vlc-timer
0 libsystem_kernel.dylib 0x188de99ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x188e2755c _pthread_cond_wait + 1228
2 libvlccore.9.dylib 0x100b8de6c vlc_atomic_wait + 128 (wait.c:86)
3 libvlccore.9.dylib 0x100b742f4 vlc_cond_wait + 160 (threads.c:288)
4 libvlccore.9.dylib 0x100b8dac4 vlc_timer_thread + 192 (timer.c:67)
5 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
6 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 20:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x188de61f4 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x188df8b24 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x188deee34 mach_msg_overwrite + 476
3 libsystem_kernel.dylib 0x188de6578 mach_msg + 24
4 CoreFoundation 0x188f06058 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x188f0491c __CFRunLoopRun + 1208
6 CoreFoundation 0x188f03e0c CFRunLoopRunSpecific + 608
7 AppKit 0x18c885cb4 _NSEventThread + 144
8 libsystem_pthread.dylib 0x188e26f94 _pthread_start + 136
9 libsystem_pthread.dylib 0x188e21d34 thread_start + 8
Thread 21:
0 libsystem_pthread.dylib 0x188e21d20 start_wqthread + 0
Thread 22:
0 libsystem_pthread.dylib 0x188e21d20 start_wqthread + 0
Thread 23:
0 libsystem_pthread.dylib 0x188e21d20 start_wqthread + 0
Thread 24:
0 libsystem_pthread.dylib 0x188e21d20 start_wqthread + 0
Thread 25:
0 libsystem_pthread.dylib 0x188e21d20 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x0000000188de22cb x5: 0x000000016fa71860 x6: 0x000000000000006e x7: 0x0000000000000000
x8: 0xf5f788922074c77a x9: 0xf5f78893d0c7fdba x10: 0x0000000000000200 x11: 0x000000000000000b
x12: 0x0000000000000000 x13: 0x00000000001ff800 x14: 0x00000000000007fb x15: 0x00000000f9c36838
x16: 0x0000000000000148 x17: 0x00000001fae9ec30 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x00000001f0b33ac0 x21: 0x0000000000000103 x22: 0x00000001f0b33ba0 x23: 0x0000000000000000
x24: 0x000000014c667420 x25: 0x0000000000000000 x26: 0x0000000000000000 x27: 0x00000001f0b86bc0
x28: 0x000000014d8776cc fp: 0x000000016fa717d0 lr: 0x0000000188e26c20
sp: 0x000000016fa717b0 pc: 0x0000000188deea60 cpsr: 0x40001000
far: 0x0000000000000000 esr: 0x56000080 Address size fault
Signed-off-by: Claudio Cambra developer@claudiocambra.com