From 6d9deb36f2d110719fe0292f1807d296b0d65544 Mon Sep 17 00:00:00 2001 From: Henry Z Date: Sun, 29 Oct 2023 17:48:03 +0400 Subject: [PATCH] [fix]: blocking system assertions --- YYText/Utility/YYTextAsyncLayer.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/YYText/Utility/YYTextAsyncLayer.m b/YYText/Utility/YYTextAsyncLayer.m index e94bc47e..aa8669df 100644 --- a/YYText/Utility/YYTextAsyncLayer.m +++ b/YYText/Utility/YYTextAsyncLayer.m @@ -155,6 +155,9 @@ - (void)_displayAsync:(BOOL)async { CGColorRelease(backgroundColor); return; } + if ((size.width == 0) || (size.height == 0)) { + return; + } UIGraphicsBeginImageContextWithOptions(size, opaque, scale); CGContextRef context = UIGraphicsGetCurrentContext(); if (opaque) { @@ -198,6 +201,9 @@ - (void)_displayAsync:(BOOL)async { }); }); } else { + if ((self.bounds.size.width == 0) || (self.bounds.size.height == 0)) { + return; + } [_sentinel increase]; if (task.willDisplay) task.willDisplay(self); UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, self.contentsScale);