Skip to content

Commit

Permalink
bugfix: ibireme#984 UIGraphicsBeginImageContext() failed to allocate …
Browse files Browse the repository at this point in the history
…CGBitampContext: size={382, 0}. Use UIGraphicsImageRenderer to avoid this assert.
  • Loading branch information
wjiuxing committed Oct 19, 2023
1 parent 7bd2aa4 commit 4a9f460
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions YYText/Utility/YYTextAsyncLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ - (void)display {
#pragma mark - Private

- (void)_displayAsync:(BOOL)async {
// refer: https://github.com/ibireme/YYText/issues/984
if (self.bounds.size.width <= 0
|| self.bounds.size.height <= 0) {
self.contents = nil;
return;
}

__strong id<YYTextAsyncLayerDelegate> delegate = (id)self.delegate;
YYTextAsyncLayerDisplayTask *task = [delegate newAsyncDisplayTask];
if (!task.display) {
Expand Down

0 comments on commit 4a9f460

Please sign in to comment.