Safe calls in ASTextNodeRenderer

fixes #190
This commit is contained in:
Ryan Nystrom
2014-12-30 10:55:04 -08:00
parent 13c57020c1
commit 7e30b10f13
3 changed files with 6 additions and 7 deletions

View File

@@ -578,11 +578,10 @@ static const CGFloat ASTextNodeRendererTextCapHeightPadding = 1.3;
#pragma mark - Drawing
- (void)drawInRect:(CGRect)bounds isRasterizing:(BOOL)isRasterizing
- (void)drawInRect:(CGRect)bounds inContext:(CGContextRef)context
{
CGContextRef context = UIGraphicsGetCurrentContext();
ASDisplayNodeAssert(context, @"This is no good without a context.");
UIGraphicsPushContext(context);
CGContextSaveGState(context);
[self _initializeTextKitComponentsIfNeeded];
@@ -594,6 +593,7 @@ static const CGFloat ASTextNodeRendererTextCapHeightPadding = 1.3;
}
CGContextRestoreGState(context);
UIGraphicsPopContext();
}
#pragma mark - String Ranges