Skip to content

Commit

Permalink
Don't call CreateText() if there's nothing to do
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 4, 2024
1 parent 5992548 commit 62eab79
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions src/SDL_renderer_textengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 62eab79

Please sign in to comment.