SDL_ttf: Fixed crash when updating a zero sized glyph

From f27c9ea96960caf83ad113ccb66d44fcb7e6c1a6 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 23 Jan 2025 15:51:25 -0800
Subject: [PATCH] Fixed crash when updating a zero sized glyph

---
 src/SDL_gpu_textengine.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/SDL_gpu_textengine.c b/src/SDL_gpu_textengine.c
index e3601c4f..95922dd6 100644
--- a/src/SDL_gpu_textengine.c
+++ b/src/SDL_gpu_textengine.c
@@ -380,8 +380,10 @@ static bool UpdateGPUTexture(SDL_GPUDevice *device, SDL_GPUTexture *texture,
 
 static bool UpdateGlyph(SDL_GPUDevice *device, AtlasGlyph *glyph, SDL_Surface *surface)
 {
-    /* FIXME: We should update the whole texture at once or at least cache the transfer buffers */
-    UpdateGPUTexture(device, glyph->atlas->texture, &glyph->rect, surface->pixels, surface->pitch);
+    if (glyph->rect.w > 0 || glyph->rect.h > 0) {
+        /* FIXME: We should update the whole texture at once or at least cache the transfer buffers */
+        UpdateGPUTexture(device, glyph->atlas->texture, &glyph->rect, surface->pixels, surface->pitch);
+    }
     return true;
 }