SDL: Need to check structure version before setting xdg_toplevel to NULL

From 9672d58119dd7e2236f3bb90c744406913ae6bfc Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 26 Sep 2021 14:22:11 -0700
Subject: [PATCH] Need to check structure version before setting xdg_toplevel
 to NULL

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

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 2dd251abab..f12c142556 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -651,7 +651,9 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
             }
         } else {
             info->info.wl.xdg_surface = NULL;
-            info->info.wl.xdg_toplevel = NULL;
+            if (version >= SDL_VERSIONNUM(2, 0, 17)) {
+                info->info.wl.xdg_toplevel = NULL;
+            }
         }
     }