From 085b359e60b83eb4dd465019993a864b56868c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Tue, 3 May 2022 15:02:47 +0300 Subject: [PATCH 1/1] Text: Fixed crash when looking up fonts --- src/ui/font.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/font.c b/src/ui/font.c index 5060d75e..7821c509 100644 --- a/src/ui/font.c +++ b/src/ui/font.c @@ -337,6 +337,7 @@ static void prepare_AttributedText_(iAttributedText *d, int overrideBaseDir, iCh if (isControl_Char(ch)) { continue; } + iAssert(run.font != NULL); if (ch == 0x20) { if (run.font->spec->flags & auxiliary_FontSpecFlag && ~run.font->spec->flags & allowSpacePunct_FontSpecFlag) { @@ -353,7 +354,7 @@ static void prepare_AttributedText_(iAttributedText *d, int overrideBaseDir, iCh } iBaseFont *chFont = characterFont_BaseFont(currentFont, ch); // const iGlyph *glyph = glyph_Font_(currentFont, ch); - if (chFont != run.font) { + if (chFont && chFont != run.font) { /* A different font is being used for this character. */ finishRun_AttributedText_(d, &run, pos); run.font = chFont; -- 2.34.1