SDL: wayland: Add null check for zenity version string

From 2a9480c81581bb81cb265844d54e7ee16a69c4ec Mon Sep 17 00:00:00 2001
From: Etaash Mathamsetty <[EMAIL REDACTED]>
Date: Fri, 6 Oct 2023 14:58:45 -0400
Subject: [PATCH] wayland: Add null check for zenity version string

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

diff --git a/src/video/wayland/SDL_waylandmessagebox.c b/src/video/wayland/SDL_waylandmessagebox.c
index 03149f82ca02..a7d96cbbc27a 100644
--- a/src/video/wayland/SDL_waylandmessagebox.c
+++ b/src/video/wayland/SDL_waylandmessagebox.c
@@ -96,6 +96,10 @@ static int get_zenity_version(int *major, int *minor) {
         version_ptr = fgets(version_str, ZENITY_VERSION_LEN, outputfp);
         (void)fclose(outputfp); /* will close underlying fd */
 
+        if (version_ptr == NULL) {
+            return SDL_SetError("failed to read zenity version string");
+        }
+
         /* we expect the version string is in the form of MAJOR.MINOR.MICRO
          * as described in meson.build. We'll ignore everything after that.
          */