Added status code check to prevent empty icons

This commit is contained in:
michael starke
2017-11-15 09:45:01 +01:00
parent 8a2890b4de
commit 54b101cb68

View File

@@ -137,7 +137,9 @@ typedef NS_ENUM(NSInteger, MPIconDownloadStatus) {
//[NSApp presentError:error]; //[NSApp presentError:error];
}); });
} }
if(data.length > 0) { if([response respondsToSelector:@selector(statusCode)] &&
(200 == [(id)response statusCode])
&& data.length > 0) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
KPKIcon *newIcon = [[KPKIcon alloc] initWithImageData:data]; KPKIcon *newIcon = [[KPKIcon alloc] initWithImageData:data];
if(newIcon) { if(newIcon) {