SDL: Fixed a rare crash on Raspberry Pi when creating a window (5bd0e)

From 5bd0eb068ce3ea7aaa3b95fa18e361dbad46a6d0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 20 May 2026 15:11:09 -0700
Subject: [PATCH] Fixed a rare crash on Raspberry Pi when creating a window

(cherry picked from commit 19d73016e8333cd890d16ac972c0c1a9f8c8072a)
---
 src/video/wayland/SDL_waylanddatamanager.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c
index b88566fcac156..4501efaa1a606 100644
--- a/src/video/wayland/SDL_waylanddatamanager.c
+++ b/src/video/wayland/SDL_waylanddatamanager.c
@@ -183,10 +183,14 @@ static SDL_MimeDataList *mime_data_list_find(struct wl_list *list,
 {
     SDL_MimeDataList *found = NULL;
 
-    SDL_MimeDataList *mime_list = NULL;
-    wl_list_for_each (mime_list, list, link) {
-        if (SDL_strcmp(mime_list->mime_type, mime_type) == 0) {
-            found = mime_list;
+    SDL_MimeDataList *item = NULL;
+    wl_list_for_each (item, list, link) {
+        if (!item->mime_type) {
+            continue;
+        }
+
+        if (SDL_strcmp(item->mime_type, mime_type) == 0) {
+            found = item;
             break;
         }
     }