Commit bab93f8 1 parent bde46d2 commit bab93f8 Copy full SHA for bab93f8
File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -164,21 +164,29 @@ + (NSString *)runBashCommand:(NSString *)command withEnvironment:(NSDictionary*)
164
164
if ([doc getConnection ] == nil )
165
165
doc = nil ;
166
166
else {
167
- for (NSWindow *aWindow in [NSApp orderedWindows ]) {
168
- if ([[[[aWindow windowController ] class ] description ] isEqualToString: @" SPWindowController" ]) {
169
- if ([[[aWindow windowController ] documents ] count ] && [[[[[[aWindow windowController ] documents ] objectAtIndex: 0 ] class ] description ] isEqualToString: @" SPDatabaseDocument" ]) {
167
+ for (NSWindow *aWindow in [NSApp orderedWindows ])
168
+ {
169
+ if ([[[[aWindow windowController ] class ] description ] isEqualToString: @" SPWindowController" ]) {
170
+
171
+ SPWindowController *windowController = (SPWindowController *)[aWindow windowController ];
172
+ NSArray *documents = [windowController documents ];
173
+
174
+ if ([documents count ] && [[[[documents objectAtIndex: 0 ] class ] description ] isEqualToString: @" SPDatabaseDocument" ]) {
170
175
// Check if connected
171
- if ([[[[aWindow windowController ] documents ] objectAtIndex: 0 ] getConnection ])
172
- doc = [[[aWindow windowController ] documents ] objectAtIndex: 0 ];
173
- else
176
+ if ([[documents objectAtIndex: 0 ] getConnection ]) {
177
+ doc = [documents objectAtIndex: 0 ];
178
+ }
179
+ else {
174
180
doc = nil ;
181
+ }
175
182
}
176
183
}
177
- if (doc) break ;
184
+
185
+ if (doc) break ;
178
186
}
179
187
}
180
188
181
- if (doc != nil ) {
189
+ if (doc != nil ) {
182
190
183
191
[doc setProcessID: uuid];
184
192
You can’t perform that action at this time.
0 commit comments