From c6960502ebac11b0f4de83edc20dbc671bb88d23 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Thu, 27 Feb 2025 08:57:11 +0100 Subject: [PATCH] sw_engine: hanndle empty clips Generating the outline may return false, e.g., if the shape is completely trimmed. If such a shape was used as a clip, an attempt to generate 'rle' will still be made. In such a case, a crash will occur because the outline is nullptr. --- src/renderer/sw_engine/tvgSwRle.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderer/sw_engine/tvgSwRle.cpp b/src/renderer/sw_engine/tvgSwRle.cpp index cd9f4048..ff5a92b7 100644 --- a/src/renderer/sw_engine/tvgSwRle.cpp +++ b/src/renderer/sw_engine/tvgSwRle.cpp @@ -866,6 +866,8 @@ void _replaceClipSpan(SwRle *rle, SwSpan* clippedSpans, uint32_t size) SwRle* rleRender(SwRle* rle, const SwOutline* outline, const SwBBox& renderRegion, bool antiAlias) { + if (!outline) return nullptr; + constexpr auto RENDER_POOL_SIZE = 16384L; constexpr auto BAND_SIZE = 40;