aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableSource.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-04-30 09:12:59 +0000
committerstuconnolly <stuart02@gmail.com>2010-04-30 09:12:59 +0000
commit9175848b8bbe6e4b9145a492d9b4da86adb8760d (patch)
tree6503c73eb27325f2648f2a5540a803fccd9ca533 /Source/TableSource.m
parentd58412afcda9f4ec350012a6b6e4e9eb71b27155 (diff)
downloadsequelpro-9175848b8bbe6e4b9145a492d9b4da86adb8760d.tar.gz
sequelpro-9175848b8bbe6e4b9145a492d9b4da86adb8760d.tar.bz2
sequelpro-9175848b8bbe6e4b9145a492d9b4da86adb8760d.zip
Perform additional index bounds checking before attempting to remove a table field. Fixes exception http://spbug.com/l/100.
Diffstat (limited to 'Source/TableSource.m')
-rw-r--r--Source/TableSource.m6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 677b0810..034a71b9 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -346,6 +346,10 @@
// Check whether a save of the current row is required.
if (![self saveRowOnDeselect]) return;
+
+ NSInteger index = [tableSourceView selectedRow];
+
+ if ((index == -1) || (index > ([tableFields count] - 1))) return;
// Check if the user tries to delete the last defined field in table
// Note that because of better menu item validation, this check will now never evaluate to true.
@@ -362,7 +366,7 @@
}
- NSString *field = [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"];
+ NSString *field = [[tableFields objectAtIndex:index] objectForKey:@"Field"];
BOOL hasForeignKey = NO;
NSString *referencedTable = @"";