SDL: wayland: Bail out if a null cached cursor is returned

From 0e37bc7c3ff441cce201bdded0f1ace11702c648 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Tue, 6 Aug 2024 11:17:13 -0400
Subject: [PATCH] wayland: Bail out if a null cached cursor is returned

---
 src/video/wayland/SDL_waylandmouse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 30570c67ccb06..3a88fcf06daab 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -718,6 +718,9 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor)
             }
         } else {
             Wayland_CachedCustomCursor *cached = Wayland_GetCachedCustomCursor(cursor);
+            if (!cached) {
+                return -1;
+            }
             dst_width = cached->dst_width;
             dst_height = cached->dst_height;
             scale = cached->scale;