diff --git a/View Controllers/TaskEditViewController.m b/View Controllers/TaskEditViewController.m index 62aceed..f935fe8 100644 --- a/View Controllers/TaskEditViewController.m +++ b/View Controllers/TaskEditViewController.m @@ -412,8 +412,8 @@ - (void) priorityWasSelected:(NSInteger *)selectedIndex element:(id)element { - (void) projectWasSelected:(NSInteger *)selectedIndex element:(id)element { self.actionSheetPicker = nil; - if (selectedIndex >= 0) { - id taskBag = self.appDelegate.taskBag; + id taskBag = self.appDelegate.taskBag; + if (selectedIndex >= 0 && [[taskBag projects] count ] > 0) { NSString *item = [[taskBag projects] objectAtIndex:selectedIndex]; if (! [TaskUtil taskHasProject:self.textView.text project:item]) { @@ -429,8 +429,8 @@ - (void) projectWasSelected:(NSInteger *)selectedIndex element:(id)element { - (void) contextWasSelected:(NSInteger *)selectedIndex element:(id)element { self.actionSheetPicker = nil; - if (selectedIndex >= 0) { - id taskBag = self.appDelegate.taskBag; + id taskBag = self.appDelegate.taskBag; + if (selectedIndex >= 0 && [[taskBag contexts] count] > 0) { NSString *item = [[taskBag contexts] objectAtIndex:selectedIndex]; if (! [TaskUtil taskHasContext:self.textView.text context:item]) {