bigfish24 / ABFRealmSearchViewController

Drop-in text search interface for Realm data
MIT License
87 stars 19 forks source link

Crash with index out of bounds #12

Closed Ladylag closed 8 years ago

Ladylag commented 8 years ago

Environment information: XCode 7.3.1 Realm 1.0.1 ABFRealmSearchViewController 2.1

Crash: The crash occurs on line 251 of ABFRealmSearchViewController: id object = [self.results objectAtIndex:indexPath.row];

Terminating app due to uncaught exception 'RLMException', reason: 'Index 1 is out of bounds (must be less than 1)' * First throw call stack: ( 0 CoreFoundation 0x0120e494 exceptionPreprocess + 180 1 libobjc.A.dylib 0x00cc6e02 objc_exception_throw + 50 2 realmTest 0x0025d8f6 _ZL10throwErrorP8NSString + 662 3 realmTest 0x0025a3c4 _ZL15translateErrorsIZ28-[RLMResults objectAtIndex:]E3$_3EDaOT_P8NSString + 116 4 realmTest 0x0025a345 -[RLMResults objectAtIndex:] + 69 5 realmTest 0x0007661d -[ABFRealmSearchViewController tableView:cellForRowAtIndexPath:] + 173 6 UIKit 0x01a41804 -[_UIFilteredDataSource tableView:cellForRowAtIndexPath:] + 102 7 UIKit 0x01733934 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 822 8 UIKit 0x01733a7d -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 90 9 UIKit 0x01703b32 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3347 10 UIKit 0x01722416 __29-[UITableView layoutSubviews]_block_invoke + 52 11 UIKit 0x0173d6cc -[UITableView _performWithCachedTraitCollection:] + 88 12 UIKit 0x017222eb -[UITableView layoutSubviews] + 214 13 UIKit 0x016783d4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 810 14 libobjc.A.dylib 0x00cdb059 -[NSObject performSelector:withObject:] + 70 15 QuartzCore 0x0554a096 -[CALayer layoutSublayers] + 144 16 QuartzCore 0x0553d8b6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 388 17 QuartzCore 0x0553d71a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 18 QuartzCore 0x0552fee7 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 317 19 QuartzCore 0x05564847 _ZN2CA11Transaction6commitEv + 561 20 QuartzCore 0x05565108 _ZN2CA11Transaction17observer_callbackEP19CFRunLoopObservermPv + 92 21 CoreFoundation 0x0112075e CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION** + 30 22 CoreFoundation 0x011206be CFRunLoopDoObservers + 398 23 CoreFoundation 0x0111603c CFRunLoopRun + 1340 24 CoreFoundation 0x01115846 CFRunLoopRunSpecific + 470 25 CoreFoundation 0x0111565b CFRunLoopRunInMode + 123 26 GraphicsServices 0x04919664 GSEventRunModal + 192 27 GraphicsServices 0x049194a1 GSEventRun + 104 28 UIKit 0x015a7eb9 UIApplicationMain + 160 29 realmTest 0x00074c8a main + 138 30 libdyld.dylib 0x02c0ea25 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

Description: This happens when I type two characters into the searchbar. The first character correctly filters the tableview and shows me the filtered results. The second character I type in causes the crash.

I have an extremely simple test project set up which subclasses ABFRealmSearchViewController and implements the cellForObject method. I'm searching against the only entity in the database which has a single nsstring field "name"

Please let me know I can provide any more information that could be of help.

Ladylag commented 8 years ago

This turned out to be my own fault. I was overriding a tableview method I shouldn't have been in my subclass of search controller.