aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPNavigatorController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-29 14:22:37 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-29 14:22:37 +0000
commitd8f38f5740abe258fbcf339c6a666415e67feb57 (patch)
tree3151afe8da1bac83569d77c18e988a0fc986f0de /Source/SPNavigatorController.m
parente9220681f3ad83c507ffd075844eab702f08405b (diff)
downloadsequelpro-d8f38f5740abe258fbcf339c6a666415e67feb57.tar.gz
sequelpro-d8f38f5740abe258fbcf339c6a666415e67feb57.tar.bz2
sequelpro-d8f38f5740abe258fbcf339c6a666415e67feb57.zip
• added some more sanity checks to avoid exceptions due to threading
Diffstat (limited to 'Source/SPNavigatorController.m')
-rw-r--r--Source/SPNavigatorController.m29
1 files changed, 19 insertions, 10 deletions
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index 90a6fdf2..30418e1e 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -181,7 +181,7 @@ static SPNavigatorController *sharedNavigatorController = nil;
selection = [outlineSchema1 selectedItem];
if(selection) {
id parentObject = [outlineSchema1 parentForItem:selection] ? [outlineSchema1 parentForItem:selection] : schemaData;
- if(!parentObject) return;
+ if(!parentObject || ![parentObject isKindOfClass:[NSDictionary class]] || ![parentObject objectForKey:selection]) return;
id parentKeys = [parentObject allKeysForObject:selection];
if(parentKeys && [parentKeys count] == 1)
selectedKey1 = [[parentKeys objectAtIndex:0] description];
@@ -195,7 +195,7 @@ static SPNavigatorController *sharedNavigatorController = nil;
selection = [outlineSchema2 selectedItem];
if(selection) {
id parentObject = [outlineSchema2 parentForItem:selection] ? [outlineSchema2 parentForItem:selection] : schemaData;
- if(!parentObject) return;
+ if(!parentObject || ![parentObject isKindOfClass:[NSDictionary class]] || ![parentObject objectForKey:selection]) return;
id parentKeys = [parentObject allKeysForObject:selection];
if(parentKeys && [parentKeys count] == 1)
selectedKey2 = [[parentKeys objectAtIndex:0] description];
@@ -321,11 +321,17 @@ static SPNavigatorController *sharedNavigatorController = nil;
}
if(docCounter > 1) return;
-
- [schemaDataFiltered removeObjectForKey:connectionID];
- [schemaData removeObjectForKey:connectionID];
- [allSchemaKeys removeObjectForKey:connectionID];
- [self saveSelectedItems];
+
+ if(schemaData && [schemaData objectForKey:connectionID])
+ [self saveSelectedItems];
+
+ if(schemaDataFiltered)
+ [schemaDataFiltered removeObjectForKey:connectionID];
+ if(schemaData)
+ [schemaData removeObjectForKey:connectionID];
+ if(allSchemaKeys)
+ [allSchemaKeys removeObjectForKey:connectionID];
+
[outlineSchema1 reloadData];
[outlineSchema2 reloadData];
[self restoreSelectedItems];
@@ -481,9 +487,12 @@ static SPNavigatorController *sharedNavigatorController = nil;
- (NSArray *)allSchemaKeysForConnection:(NSString*)connectionID
{
- if([allSchemaKeys objectForKey:connectionID])
- return [NSArray arrayWithArray:[allSchemaKeys objectForKey:connectionID]];
- return [NSArray array];
+ if([allSchemaKeys objectForKey:connectionID]) {
+ NSArray *a = [allSchemaKeys objectForKey:connectionID];
+ if(a && [a count])
+ return a;
+ }
+ return nil;
}
/**