todotxt / todo.txt-ios

Official Todo.txt iOS app for managing your todo.txt file stored in Dropbox.
http://todotxt.org
GNU General Public License v3.0
379 stars 112 forks source link

Application crashes on selecting done with no items within context menus #233

Open stevendpclark opened 9 years ago

stevendpclark commented 9 years ago

Within the Edit Task screen, if you bring up one of the context menus which have no items populated within them and select the Done button the application will crash. Within the application logs you see the following exception.

2014-10-19 23:49:04.401 Todo.txt[8318:244782] Picker: <ActionSheetStringPicker: 0x7fd8fa5c6d70>
2014-10-19 23:49:04.402 Todo.txt[8318:244782] Selected Index: 0
2014-10-19 23:49:04.402 Todo.txt[8318:244782] Selected Value: (null)
2014-10-19 23:49:04.405 Todo.txt[8318:244782] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000108ece3f5 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000108b37bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000108dc65be -[__NSArrayI objectAtIndex:] + 190
    3   Todo.txt                            0x00000001064e75b7 -[TaskEditViewController projectWasSelected:element:] + 215
    4   Todo.txt                            0x00000001064e8dab __57-[TaskEditViewController keyboardAccessoryButtonPressed:]_block_invoke_2403 + 203
    5   Todo.txt                            0x00000001064d4410 -[ActionSheetStringPicker notifyTarget:didSucceedWithAction:origin:] + 544
    6   Todo.txt                            0x00000001064a9e92 -[AbstractActionSheetPicker actionPickerDone:] + 162
    7   UIKit                               0x00000001075aa9ee -[UIApplication sendAction:to:from:forEvent:] + 75 

This does not happen when you select the Cancel button.

stevendpclark commented 9 years ago

Should be resolved with pull request https://github.com/ginatrapani/todo.txt-ios/pull/236