From 17fef77e1cc5698bb76a0e810e52f802ae11a07e Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:38:47 -0400 Subject: [PATCH] Fix: TextShaper::splitTextRuns handling of empty input --- lib/ivis_opengl/textdraw.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ivis_opengl/textdraw.cpp b/lib/ivis_opengl/textdraw.cpp index a922461f8de..6e71867014b 100644 --- a/lib/ivis_opengl/textdraw.cpp +++ b/lib/ivis_opengl/textdraw.cpp @@ -864,12 +864,16 @@ struct TextShaper { std::vector textRuns; #if defined(WZ_FRIBIDI_ENABLED) - FriBidiParType baseDirection; + FriBidiParType baseDirection = FRIBIDI_PAR_LTR; #endif }; SplitTextRunsResult splitTextRuns(const std::vector& codePoints, iV_fonts fontID) { + if (codePoints.empty()) + { + return {}; + } int codePoints_size = static_cast(codePoints.size()); #if SIZE_MAX > INT32_MAX if (codePoints.size() > static_cast(std::numeric_limits::max()))