Skip to content

Commit

Permalink
error handling improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
YuAo committed Jan 10, 2019
1 parent cfd5dfa commit 9bd7b62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Frameworks/MetalPetal/MTITextureLoaderForiOS9.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ + (instancetype)newTextureLoaderWithDevice:(id<MTLDevice>)device {
if (CGImageSourceGetCount(imageSource) > 0) {
CGImageRef image = CGImageSourceCreateImageAtIndex(imageSource, 0, (CFDictionaryRef)imageSourceOptions);
CFRelease(imageSource);
if (!image) {
if (error) {
*error = [[NSError alloc] initWithDomain:MTITextureLoaderForiOS9ErrorDomain code:MTITextureLoaderForiOS9ErrorCannotDecodeImage userInfo:nil];
}
return nil;
}
id<MTLTexture> texture = [self newTextureWithCGImage:image options:options error:error];
CGImageRelease(image);
return texture;
Expand Down

0 comments on commit 9bd7b62

Please sign in to comment.