From 257de23efc7dcd589abcffafe31832fc8b936fa4 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 20 May 2026 14:56:54 -0700
Subject: [PATCH] Fixed a rare crash on Raspberry Pi when creating a window
(cherry picked from commit 0dbd9d2a65634cae4555b4d47771009b3c9fcae4)
---
src/video/wayland/SDL_waylanddatamanager.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c
index 6b9d045caf8da..b88566fcac156 100644
--- a/src/video/wayland/SDL_waylanddatamanager.c
+++ b/src/video/wayland/SDL_waylanddatamanager.c
@@ -470,6 +470,10 @@ void Wayland_data_offer_notify_from_mimes(SDL_WaylandDataOffer *offer, bool chec
// Do a first pass to compute allocation size.
SDL_MimeDataList *item = NULL;
wl_list_for_each(item, &offer->mimes, link) {
+ if (!item->mime_type) {
+ continue;
+ }
+
// If origin metadata is found, queue a check and wait for confirmation that this offer isn't recursive.
if (check_origin && SDL_strcmp(item->mime_type, SDL_DATA_ORIGIN_MIME) == 0) {
Wayland_data_offer_check_source(offer, item->mime_type);
@@ -493,6 +497,10 @@ void Wayland_data_offer_notify_from_mimes(SDL_WaylandDataOffer *offer, bool chec
item = NULL;
int i = 0;
wl_list_for_each(item, &offer->mimes, link) {
+ if (!item->mime_type) {
+ continue;
+ }
+
new_mime_types[i] = strPtr;
strPtr = stpcpy(strPtr, item->mime_type) + 1;
i++;