Fix some stray tabs and style violations.
[enjoyable.git] / NJMappingsController.m
index 0adb1f9..45085b5 100644 (file)
     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]];
 }