From 5940f8416fe74f9abfc5726644dcbfe81dbf34c8 Mon Sep 17 00:00:00 2001 From: euklid Date: Sun, 16 Nov 2014 20:05:22 +0100 Subject: [PATCH] Fixing possible access to a nil pointer --- RMShapedImageView/RMShapedImageView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RMShapedImageView/RMShapedImageView.m b/RMShapedImageView/RMShapedImageView.m index 7077f67..0122240 100644 --- a/RMShapedImageView/RMShapedImageView.m +++ b/RMShapedImageView/RMShapedImageView.m @@ -143,7 +143,11 @@ - (BOOL)isAlphaVisibleAtImagePoint:(CGPoint)point NULL, // colorspace can be NULL when using kCGImageAlphaOnly. See: http://developer.apple.com/library/mac/#qa/qa1037/_index.html kCGImageAlphaOnly); } - + + if (!context) { + return NO; + } + CGContextSetBlendMode(context, kCGBlendModeCopy); CGContextTranslateCTM(context, -queryRect.origin.x, queryRect.origin.y-(CGFloat)self.image.size.height); CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, (CGFloat)self.image.size.width, (CGFloat)self.image.size.height), self.image.CGImage);