aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-04-29 20:40:19 +0000
committerstuconnolly <stuart02@gmail.com>2010-04-29 20:40:19 +0000
commit2f0c9d92e3ce912049e56b6d12b5fa8eb107c8cd (patch)
tree02d87e15e664ba1a8735964ecd0d283733a1de63
parentf24fb1fb21d9c73c707d3c32ab4b6e380131ce8a (diff)
downloadsequelpro-2f0c9d92e3ce912049e56b6d12b5fa8eb107c8cd.tar.gz
sequelpro-2f0c9d92e3ce912049e56b6d12b5fa8eb107c8cd.tar.bz2
sequelpro-2f0c9d92e3ce912049e56b6d12b5fa8eb107c8cd.zip
Perform index range checking before attempting to remove a table index. Fixes exception http://spbug.com/l/164.
-rw-r--r--Source/TableSource.m8
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 851e9fef..677b0810 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -409,8 +409,12 @@
// Check whether a save of the current fields row is required.
if (![self saveRowOnDeselect]) return;
- NSString *keyName = [[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Key_name"];
- NSString *columnName = [[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Column_name"];
+ NSInteger index = [indexView selectedRow];
+
+ if ((index == -1) || (index > ([indexes count] - 1))) return;
+
+ NSString *keyName = [[indexes objectAtIndex:index] objectForKey:@"Key_name"];
+ NSString *columnName = [[indexes objectAtIndex:index] objectForKey:@"Column_name"];
BOOL hasForeignKey = NO;
NSString *constraintName = @"";