SDL: wayland: Sanity check pointers and protocols before confining (60e8f)

From 60e8ff16dc147780c7ffee030adc870b9e6042d1 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sun, 29 Oct 2023 14:23:14 -0400
Subject: [PATCH] wayland: Sanity check pointers and protocols before confining

(cherry picked from commit 875e45e70b4086ca8cdff405231fc616f06cda7e)
---
 src/video/wayland/SDL_waylandevents.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 2b87925321a8..628722680c55 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -2581,6 +2581,10 @@ static void lock_pointer_to_window(SDL_Window *window,
     SDL_VideoData *d = input->display;
     struct zwp_locked_pointer_v1 *locked_pointer;
 
+    if (!d->pointer_constraints || !input->pointer) {
+        return;
+    }
+
     if (w->locked_pointer) {
         return;
     }