diff --git a/source/utils/DrawUtils.cpp b/source/utils/DrawUtils.cpp index 2c438da..d1684ca 100644 --- a/source/utils/DrawUtils.cpp +++ b/source/utils/DrawUtils.cpp @@ -305,12 +305,6 @@ void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignR textureWidth = (mtx.minWidth + 3) & ~3; textureHeight = mtx.minHeight; - SFT_Image img = { - .pixels = nullptr, - .width = textureWidth, - .height = textureHeight, - }; - if (textureWidth == 0) { textureWidth = 4; } @@ -318,6 +312,12 @@ void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignR textureHeight = 4; } + SFT_Image img = { + .pixels = nullptr, + .width = textureWidth, + .height = textureHeight, + }; + auto buffer = make_unique_nothrow((uint32_t) (img.width * img.height)); if (!buffer) { DEBUG_FUNCTION_LINE_ERR("Failed to allocate memory for glyph");