aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableSource.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/TableSource.m')
-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 = @"";