xcode - removeobjectAtIndex: causes index to be -1; -


i have nstableview populated array called tablearray. have button supposed remove selected item array. in removeitem: method:

[tablearray removeobjectatindex:[tableview selectedrow]; [tableview reloaddata]; 

but error:

2015-05-13 18:16:45.283 fileshedb1.0[979:303] *** -[__nsarraym objectatindex:]: index 18446744073709551615 beyond bounds [0 .. 0] 2015-05-13 18:16:45.288 fileshedb1.0[979:303] (     0   corefoundation                      0x00007fff8d35ff56 __exceptionpreprocess + 198     1   libobjc.a.dylib                     0x00007fff93119d5e objc_exception_throw + 43     2   corefoundation                      0x00007fff8d2ed392 -[__nsarraym objectatindex:] + 274     3   fileshedb1.0                        0x00000001000028a9 -[mpomainwindowcontroller tableviewselectiondidchange:] + 201     4   foundation                          0x00007fff8cca0d0e __-[nsnotificationcenter addobserver:selector:name:object:]_block_invoke_1 + 47     5   corefoundation                      0x00007fff8d3087ba _cfxnotificationpost + 2634     6   foundation                          0x00007fff8cc8cfc3 -[nsnotificationcenter postnotificationname:object:userinfo:] + 65     7   appkit                              0x00007fff8ab10049 -[nstableview _sendselectionchangednotificationforrows:columns:] + 203     8   appkit                              0x00007fff8aae6b0a -[nstableview _enableselectionpostingandpost] + 425     9   appkit                              0x00007fff8aadcd75 -[nstableview _tileandredisplayall] + 358     10  fileshedb1.0                        0x00000001000027bc -[mpomainwindowcontroller removefile:] + 188     11  corefoundation                      0x00007fff8d34f70d -[nsobject performselector:withobject:] + 61     12  appkit                              0x00007fff8aaa98ca -[nsapplication sendaction:to:from:] + 139     13  appkit                              0x00007fff8aaa97fe -[nscontrol sendaction:to:] + 88     14  appkit                              0x00007fff8aaa9729 -[nscell _sendactionfrom:] + 137     15  appkit                              0x00007fff8aaa8bec -[nscell trackmouse:inrect:ofview:untilmouseup:] + 2014     16  appkit                              0x00007fff8ab28b74 -[nsbuttoncell trackmouse:inrect:ofview:untilmouseup:] + 489     17  appkit                              0x00007fff8aaa77f6 -[nscontrol mousedown:] + 786     18  appkit                              0x00007fff8aa72c98 -[nswindow sendevent:] + 6306     19  appkit                              0x00007fff8aa0c3a5 -[nsapplication sendevent:] + 5593     20  appkit                              0x00007fff8a9a2a0e -[nsapplication run] + 555     21  appkit                              0x00007fff8ac1eeac nsapplicationmain + 867     22  fileshedb1.0                        0x00000001000014c2 main + 34     23  fileshedb1.0                        0x0000000100001494 start + 52 ) 

anyone know why i'm getting error?

if no row selected, selectedrow row returns -1. put check this.

checkout apple's documentation.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -