From 870021b8bd15a7e0303f445aabb8884677e48369 Mon Sep 17 00:00:00 2001 From: slime Date: Sun, 24 Jul 2022 16:23:56 -0300 Subject: [PATCH] Potentially fix a crash when calling Text:add(""). #1824 --- src/modules/graphics/Text.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/graphics/Text.cpp b/src/modules/graphics/Text.cpp index 9991aa681..7d53dacee 100644 --- a/src/modules/graphics/Text.cpp +++ b/src/modules/graphics/Text.cpp @@ -113,7 +113,6 @@ void Text::addTextData(const TextData &t) size_t voffset = vert_offset; - // Must be before the early exit below. if (!t.append_vertices) { voffset = 0; @@ -122,8 +121,8 @@ void Text::addTextData(const TextData &t) text_data.clear(); } - if (t.use_matrix) - t.matrix.transformXY(&vertices[0], &vertices[0], (int) vertices.size()); + if (t.use_matrix && !vertices.empty()) + t.matrix.transformXY(vertices.data(), vertices.data(), (int) vertices.size()); uploadVertices(vertices, voffset);