From 9041ba977f34b90c163f960571372d9ec243c1df Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Sun, 13 Oct 2013 08:08:15 -0700 Subject: [PATCH] Fixed Last.fm command queue crashing --- AudioScrobbler/AudioScrobbler.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AudioScrobbler/AudioScrobbler.m b/AudioScrobbler/AudioScrobbler.m index 364e0b7fe..76a69f6d0 100644 --- a/AudioScrobbler/AudioScrobbler.m +++ b/AudioScrobbler/AudioScrobbler.m @@ -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];