From 7ce2632bfc035257b1f7af80ed8cf1c61af8efaf Mon Sep 17 00:00:00 2001
From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
Date: Fri, 21 Feb 2025 21:16:02 +0100
Subject: [PATCH] Fix "Wayland: resizing window may crash the program" (#1210)

---
 src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 290d328d8..e922a8153 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -1933,7 +1933,9 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
         wl_subsurface_set_position(fl_win->subsurface, X * f, Y * f);
         wl_surface_commit(parent_xid->wl_surface);
       } else if (!xid_rect) {
-        if (is_a_move) wl_subsurface_set_position(fl_win->subsurface, X * f, Y * f);
+        if (is_a_move && fl_win->subsurface) {
+          wl_subsurface_set_position(fl_win->subsurface, X * f, Y * f);
+        }
         wl_surface_commit(parent_xid->wl_surface);
       }
     }
-- 
GitLab