YapDatabase
YapDatabase copied to clipboard
Crash in YapDatabaseViewTransaction insertRowid:collectionKey:inGroup:atIndex:
It looks like we need to add a nil check on YapDatabaseViewTransaction.m:1326
Thread 6 Crashed:
0 CoreFoundation 0x00000001845aad8c __exceptionPreprocess + 228
1 libobjc.A.dylib 0x00000001837645ec objc_exception_throw + 52
2 CoreFoundation 0x0000000184543750 _CFThrowFormattedException + 108
3 CoreFoundation 0x0000000184478c6c -[__NSDictionaryM setObject:forKey:] + 944
4 YapDatabase 0x000000010344c680 -[YapDatabaseViewTransaction insertRowid:collectionKey:inGroup:atIndex:] (YapDatabaseViewTransaction.m:1326)
5 YapDatabase 0x000000010338d224 -[YapDatabaseAutoViewTransaction insertRowid:collectionKey:object:metadata:inGroup:withChanges:isNew:] (YapDatabaseAutoViewTransaction.m:719)
6 YapDatabase 0x000000010338dda0 -[YapDatabaseAutoViewTransaction _handleChangeWithRowid:collectionKey:object:metadata:grouping:sorting:blockInvokeBitMask:changesBitMask:isInsert:] (YapDatabaseAutoViewTransaction.m:878)
7 YapDatabase 0x000000010338dfd4 -[YapDatabaseAutoViewTransaction didUpdateObject:forCollectionKey:withMetadata:rowid:] (YapDatabaseAutoViewTransaction.m:945)
8 YapDatabase 0x00000001034309fc -[YapDatabaseReadWriteTransaction setObject:forKey:inCollection:withMetadata:serializedObject:serializedMetadata:] (YapDatabaseTransaction.m:0)
9 YapDatabase 0x000000010342fcd8 -[YapDatabaseReadWriteTransaction setObject:forKey:inCollection:withMetadata:] (YapDatabaseTransaction.m:4680)
10 ChatSecureCore 0x000000010380aaf8 -[OTRYapDatabaseObject saveWithTransaction:] (OTRYapDatabaseObject.m:32)
11 ChatSecureCore 0x00000001038fe8a0 0x1037cc000 + 1255584 (block_destroy_helper + 1428)
12 ChatSecureCore 0x00000001038fe2e8 partial apply forwarder for closure #1 (__C.YapDatabaseReadWriteTransaction) -> () in ChatSecureCore.RosterStorage.xmppRoster(_: __C.XMPPRoster, didReceiveRosterItem: __C.DDXMLElement) -> () (RosterStorage.swift:0)
13 ChatSecureCore 0x00000001038bc8dc reabstraction thunk helper from @escaping @callee_guaranteed (@owned __C.YapDatabaseReadWriteTransaction) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.YapDatabaseReadWriteTransaction) -> () (OTRStreamManagementDelegate.swift:0)
14 YapDatabase 0x00000001033c5408 __81-[YapDatabaseConnection asyncReadWriteWithBlock:completionQueue:completionBlock:]_block_invoke_2 (YapDatabaseConnection.m:2335)
15 libdispatch.dylib 0x0000000183e9ca60 _dispatch_client_callout + 12
16 libdispatch.dylib 0x0000000183ea55bc _dispatch_queue_barrier_sync_invoke_and_complete + 52
17 YapDatabase 0x00000001033c533c __81-[YapDatabaseConnection asyncReadWriteWithBlock:completionQueue:completionBlock:]_block_invoke (YapDatabaseConnection.m:2330)
18 libdispatch.dylib 0x0000000183e9caa0 _dispatch_call_block_and_release + 20
19 libdispatch.dylib 0x0000000183e9ca60 _dispatch_client_callout + 12
20 libdispatch.dylib 0x0000000183ea69b4 _dispatch_queue_serial_drain$VARIANT$mp + 604
21 libdispatch.dylib 0x0000000183ea72fc _dispatch_queue_invoke$VARIANT$mp + 332
22 libdispatch.dylib 0x0000000183ea7cc8 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 336
23 libdispatch.dylib 0x0000000183eb0098 _dispatch_workloop_worker_thread$VARIANT$mp + 664
24 libsystem_pthread.dylib 0x00000001841cfe70 _pthread_wqthread + 856
25 libsystem_pthread.dylib 0x00000001841cfb08 start_wqthread + 0
Just to verify: this crash is due to the key being nil (in the call to [__NSDictionaryM setObject:forKey:]) ?
Actually the key seems to be there, it's the object that's nil (???)
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: 70C7386C-B75C-49F7-8038-79B2A04E1DD6)'