From 6e4330269446278d94080e730c1a5b19978caf56 Mon Sep 17 00:00:00 2001
From: hexnet1234 <[EMAIL REDACTED]>
Date: Fri, 20 Feb 2026 18:41:55 +0100
Subject: [PATCH] Fix Wayland_DestroyWindow SEGFAULT
Check if the wind pointer is NULL, to avoid SEGFAULT.
Already implemented in SDL3, but not yet backported.
---
src/video/wayland/SDL_waylandwindow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 50527c718693a..7ae9be6fd4aca 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -2292,7 +2292,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
SDL_VideoData *data = _this->driverdata;
SDL_WindowData *wind = window->driverdata;
- if (data) {
+ if (data && wind) {
#ifdef SDL_VIDEO_OPENGL_EGL
if (wind->egl_surface) {
SDL_EGL_DestroySurface(_this, wind->egl_surface);