Fixed Last.fm command queue crashing

CQTexperiment
Chris Moeller 2013-10-13 08:08:15 -07:00
parent 70e571fed9
commit 9041ba977f
1 changed files with 5 additions and 1 deletions
AudioScrobbler

View File

@ -221,7 +221,7 @@ escapeForLastFM(NSString *string)
// Get the first command to be sent
@synchronized([self queue]) {
if ([[self queue] count]) {
command = [[self queue] objectAtIndex:0];
command = [[[self queue] objectAtIndex:0] retain];
[[self queue] removeObjectAtIndex:0];
}
}
@ -232,6 +232,7 @@ escapeForLastFM(NSString *string)
port = [client connectedPort];
[client send:command];
[command release];
command = nil;
response = [client receive];
if(2 > [response length] || NSOrderedSame != [response compare:@"OK" options:NSLiteralSearch range:NSMakeRange(0,2)])
@ -242,6 +243,9 @@ escapeForLastFM(NSString *string)
}
@catch(NSException *exception) {
[command release];
command = nil;
[client shutdown];
// ALog(@"Exception: %@",exception);
[pool release];