aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPBundleCommandRunner.m
diff options
context:
space:
mode:
authorAbhi Beckert <abhi@abhibeckert.com>2017-04-15 08:14:41 +1000
committerAbhi Beckert <abhi@abhibeckert.com>2017-04-15 08:14:41 +1000
commitd20ad5fecb5d68f7dbee83aa56bdd1d262698bc7 (patch)
tree49bbde8fe38cb95cd2dce758b998ce08df35841b /Source/SPBundleCommandRunner.m
parent1d12c0e41319ffd2a1f1ab62305bd2688910f151 (diff)
parent4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a (diff)
downloadsequelpro-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.m24
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];