SDL_ttf: fix crash dereferencing text->internal->engine before checking (ba2ca)

From ba2ca1d3f0943f55d01432d9888cdc2f7f529bbc Mon Sep 17 00:00:00 2001
From: Brenton Bostick <[EMAIL REDACTED]>
Date: Fri, 24 Oct 2025 13:30:28 -0400
Subject: [PATCH] fix crash dereferencing text->internal->engine before
 checking

(cherry picked from commit d5eb865b72f63055115093e3343ca58263ae886f)
---
 src/SDL_surface_textengine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/SDL_surface_textengine.c b/src/SDL_surface_textengine.c
index a36fb5b1..41c01a9c 100644
--- a/src/SDL_surface_textengine.c
+++ b/src/SDL_surface_textengine.c
@@ -332,7 +332,7 @@ static void DrawCopy(TTF_SurfaceTextEngineTextData *data, const TTF_CopyOperatio
 
 bool TTF_DrawSurfaceText(TTF_Text *text, int x, int y, SDL_Surface *surface)
 {
-    if (!text || !text->internal || text->internal->engine->CreateText != CreateText) {
+    if (!text || !text->internal || !text->internal->engine || text->internal->engine->CreateText != CreateText) {
         return SDL_InvalidParamError("text");
     }
     if (!surface) {