GrowlSafari: Robustify setDownloadFinished against a few potential exceptions.
authorPeter Hosey <hg@boredzo.org>
Sun Apr 18 22:53:57 2010 -0700 (2010-04-18)
changeset 46139bf3d74dc04f
parent 4612 d34cd7d301f5
child 4614 e423155bfdf1
GrowlSafari: Robustify setDownloadFinished against a few potential exceptions.

I just got a removeObjectForKey:nil exception when I pasted a URL into the Downloads window. Having no stack trace, I don't know that this was the cause, but it's certainly possible and good to fix.
Extras/GrowlSafari/GrowlSafari.m
     1.1 --- a/Extras/GrowlSafari/GrowlSafari.m	Sun Apr 18 00:05:31 2010 -0700
     1.2 +++ b/Extras/GrowlSafari/GrowlSafari.m	Sun Apr 18 22:53:57 2010 -0700
     1.3 @@ -152,7 +152,9 @@
     1.4  }
     1.5  
     1.6  static void setDownloadFinished(id dl) {
     1.7 -	[dates removeObjectForKey:[dl identifier]];
     1.8 +	if (dl && [dl respondsToSelector:@selector(identifier)] && [dl identifier]) {
     1.9 +		[dates removeObjectForKey:[dl identifier]];
    1.10 +	}
    1.11  }
    1.12  
    1.13  @implementation GrowlSafari