diff options
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 12 | ||||
-rw-r--r-- | Source/SPProcessListController.m | 25 |
2 files changed, 21 insertions, 16 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 5fd3a9a2..27ae11ae 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -2412,12 +2412,14 @@ void performThreadedKeepAlive(void *ptr) [self lockConnection]; - if (theResPtr = mysql_list_processes(mConnection)) { - result = [[MCPResult alloc] initWithResPtr:theResPtr encoding:mEncoding timeZone:mTimeZone]; + if (mConnected && (mConnection != NULL)) { + if (theResPtr = mysql_list_processes(mConnection)) { + result = [[MCPResult alloc] initWithResPtr:theResPtr encoding:mEncoding timeZone:mTimeZone]; + } + else { + result = [[MCPResult alloc] init]; + } } - else { - result = [[MCPResult alloc] init]; - } [self unlockConnection]; diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index 92744276..07c67247 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -623,17 +623,20 @@ NSUInteger i = 0; // Get processes - MCPResult *processList = [connection listProcesses]; - - [processList setReturnDataAsStrings:YES]; - - if ([processList numOfRows]) [processList dataSeek:0]; - - [processes removeAllObjects]; - - for (i = 0; i < [processList numOfRows]; i++) - { - [processes addObject:[processList fetchRowAsDictionary]]; + if ([connection isConnected]) { + + MCPResult *processList = [connection listProcesses]; + + [processList setReturnDataAsStrings:YES]; + + if ([processList numOfRows]) [processList dataSeek:0]; + + [processes removeAllObjects]; + + for (i = 0; i < [processList numOfRows]; i++) + { + [processes addObject:[processList fetchRowAsDictionary]]; + } } // Update the UI on the main thread |