From 9175848b8bbe6e4b9145a492d9b4da86adb8760d Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Fri, 30 Apr 2010 09:12:59 +0000 Subject: Perform additional index bounds checking before attempting to remove a table field. Fixes exception http://spbug.com/l/100. --- Source/TableSource.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Source') 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 = @""; -- cgit v1.2.3