From d9a90f5f29f91d4be2c118ea06e953ad8cf5b393 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 4 Oct 2024 16:35:11 -0700 Subject: [PATCH] Don't call CreateText() if there's nothing to do --- src/SDL_renderer_textengine.c | 2 -- src/SDL_ttf.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/SDL_renderer_textengine.c b/src/SDL_renderer_textengine.c index a7140461..8090e43a 100644 --- a/src/SDL_renderer_textengine.c +++ b/src/SDL_renderer_textengine.c @@ -537,8 +537,6 @@ static AtlasDrawSequence *CreateDrawSequence(TTF_DrawOperation *ops, int num_ops return NULL; } - SDL_assert(num_ops > 0); - SDL_Texture *texture = GetOperationTexture(&ops[0]); TTF_DrawOperation *end = NULL; for (int i = 1; i < num_ops; ++i) { diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c index e0ce10cd..37a7de89 100644 --- a/src/SDL_ttf.c +++ b/src/SDL_ttf.c @@ -3949,7 +3949,7 @@ static void DestroyEngineText(TTF_Text *text) static bool CreateEngineText(TTF_Text *text) { TTF_TextEngine *engine = text->internal->engine; - if (engine && engine->CreateText && text->internal->font && text->text) { + if (engine && engine->CreateText && text->internal->num_ops > 0) { if (!engine->CreateText(engine->userdata, text)) { return false; }