X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=NJMappingsController.m;h=45085b5c79dc56abb97c1c7f2e494c753e9a276c;hp=0adb1f9868fa644b16b346b907323b2b31e42a8e;hb=b8c30e0c06effb8f4a937378e5c4cf8a22f40c59;hpb=5c488091214f1aca932fa74623e024a4d0c245a2 diff --git a/NJMappingsController.m b/NJMappingsController.m index 0adb1f9..45085b5 100644 --- a/NJMappingsController.m +++ b/NJMappingsController.m @@ -116,12 +116,13 @@ if (tableView.selectedRow == 0) return; - [_mappings removeObjectAtIndex:tableView.selectedRow]; - [self activateMapping:_mappings[0]]; + NSInteger selectedRow = tableView.selectedRow; + [_mappings removeObjectAtIndex:selectedRow]; + [self activateMapping:_mappings[MIN(selectedRow, _mappings.count - 1)]]; [self mappingsChanged]; } --(void)tableViewSelectionDidChange:(NSNotification *)notify { +- (void)tableViewSelectionDidChange:(NSNotification *)notify { [self activateMapping:self[tableView.selectedRow]]; }