Skip to content

Commit

Permalink
* Copying text from the query console without having a database selec…
Browse files Browse the repository at this point in the history
…ted could cause an exception (fixes #2111)

* Text copied from the query console could have an invalid format in some setups
  • Loading branch information
dmoagx committed May 7, 2015
1 parent 7b579c9 commit 4d82718
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Source/SPQueryController.m
Expand Up @@ -171,20 +171,23 @@ - (void)copy:(id)sender
if (i < [messagesVisibleSet count]) {
SPConsoleMessage *message = NSArrayObjectAtIndex(messagesVisibleSet, i);

if (includeTimestamps || includeConnections) [string appendString:@"/* "];
if (includeTimestamps || includeConnections || includeDatabases) [string appendString:@"/* "];

if (includeTimestamps) {
[string appendString:[dateFormatter stringFromDate:[message messageDate]]];
NSDate *date = [message messageDate];
if (includeTimestamps && date) {
[string appendString:[dateFormatter stringFromDate:date]];
[string appendString:@" "];
}

if (includeConnections) {
[string appendString:[message messageConnection]];
NSString *connection = [message messageConnection];
if (includeConnections && connection) {
[string appendString:connection];
[string appendString:@" "];
}

if (includeDatabases) {
[string appendString:[message messageDatabase]];
NSString *database = [message messageDatabase];
if (includeDatabases && database) {
[string appendString:database];
[string appendString:@" "];
}

Expand Down

0 comments on commit 4d82718

Please sign in to comment.