diff options
author | Abhi Beckert <abhi@abhibeckert.com> | 2017-04-15 08:14:41 +1000 |
---|---|---|
committer | Abhi Beckert <abhi@abhibeckert.com> | 2017-04-15 08:14:41 +1000 |
commit | d20ad5fecb5d68f7dbee83aa56bdd1d262698bc7 (patch) | |
tree | 49bbde8fe38cb95cd2dce758b998ce08df35841b /Source/SPBundleCommandRunner.m | |
parent | 1d12c0e41319ffd2a1f1ab62305bd2688910f151 (diff) | |
parent | 4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a (diff) | |
download | sequelpro-d20ad5fecb5d68f7dbee83aa56bdd1d262698bc7.tar.gz sequelpro-d20ad5fecb5d68f7dbee83aa56bdd1d262698bc7.tar.bz2 sequelpro-d20ad5fecb5d68f7dbee83aa56bdd1d262698bc7.zip |
Merge remote-tracking branch 'sequelpro/master'
Diffstat (limited to 'Source/SPBundleCommandRunner.m')
-rw-r--r-- | Source/SPBundleCommandRunner.m | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/SPBundleCommandRunner.m b/Source/SPBundleCommandRunner.m index 08fad6f1..e884e21d 100644 --- a/Source/SPBundleCommandRunner.m +++ b/Source/SPBundleCommandRunner.m @@ -164,21 +164,29 @@ if([doc getConnection] == nil) doc = nil; else { - for (NSWindow *aWindow in [NSApp orderedWindows]) { - if([[[[aWindow windowController] class] description] isEqualToString:@"SPWindowController"]) { - if([[[aWindow windowController] documents] count] && [[[[[[aWindow windowController] documents] objectAtIndex:0] class] description] isEqualToString:@"SPDatabaseDocument"]) { + for (NSWindow *aWindow in [NSApp orderedWindows]) + { + if ([[[[aWindow windowController] class] description] isEqualToString:@"SPWindowController"]) { + + SPWindowController *windowController = (SPWindowController *)[aWindow windowController]; + NSArray *documents = [windowController documents]; + + if ([documents count] && [[[[documents objectAtIndex:0] class] description] isEqualToString:@"SPDatabaseDocument"]) { // Check if connected - if([[[[aWindow windowController] documents] objectAtIndex:0] getConnection]) - doc = [[[aWindow windowController] documents] objectAtIndex:0]; - else + if ([[documents objectAtIndex:0] getConnection]) { + doc = [documents objectAtIndex:0]; + } + else { doc = nil; + } } } - if(doc) break; + + if (doc) break; } } - if(doc != nil) { + if (doc != nil) { [doc setProcessID:uuid]; |