Permalink
Browse files

Merge pull request #2402 from ulion/fix_ios_thumb_crash

[IOS] Fix crash when thumb file is unreadable to ios system.
  • Loading branch information...
Memphiz committed Mar 10, 2013
2 parents 217a672 + 50b340d commit 9a9fb98a17f94690a0f9deb5b91405a0412a1a53
Showing with 10 additions and 3 deletions.
  1. +10 −3 xbmc/osx/ios/XBMCController.mm
@@ -1083,9 +1083,16 @@ - (void)onPlay:(NSDictionary *)item
NSString *thumb = [item objectForKey:@"thumb"];
if (thumb && thumb.length > 0)
{
- MPMediaItemArtwork *mArt = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageWithContentsOfFile:thumb]];
- [dict setObject:mArt forKey:MPMediaItemPropertyArtwork];
- [mArt release];
+ UIImage *image = [UIImage imageWithContentsOfFile:thumb];
+ if (image)
+ {
+ MPMediaItemArtwork *mArt = [[MPMediaItemArtwork alloc] initWithImage:image];
+ if (mArt)
+ {
+ [dict setObject:mArt forKey:MPMediaItemPropertyArtwork];
+ [mArt release];
+ }
+ }
}
// these proprity keys are ios5+ only
NSNumber *elapsed = [item objectForKey:@"elapsed"];

0 comments on commit 9a9fb98

Please sign in to comment.