From 698d02ceba72a053ed76fec6307bb83332b16bba Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 12 Aug 2024 02:01:55 +0300 Subject: [PATCH] fix fatal error caused by some unicode characters --- src/graphics/core/Font.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/graphics/core/Font.cpp b/src/graphics/core/Font.cpp index ca94bd8b..c12cd923 100644 --- a/src/graphics/core/Font.cpp +++ b/src/graphics/core/Font.cpp @@ -83,7 +83,10 @@ void Font::draw(Batch2D* batch, std::wstring_view text, int x, int y, FontStyle } uint charpage = c >> 8; if (charpage == page){ - Texture* texture = pages[charpage].get(); + Texture* texture = nullptr; + if (charpage < pages.size()) { + texture = pages[charpage].get(); + } if (texture == nullptr){ texture = pages[0].get(); }