SDL: NULL passed to strcmp in Wayland_ShowMessageBox

From 413a2306bc6264eae4e8b1209f9a33037dfe69c8 Mon Sep 17 00:00:00 2001
From: meyraud705 <[EMAIL REDACTED]>
Date: Sun, 4 Apr 2021 10:47:06 +0200
Subject: [PATCH] NULL passed to strcmp in Wayland_ShowMessageBox

---
 src/video/wayland/SDL_waylandmessagebox.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/video/wayland/SDL_waylandmessagebox.c b/src/video/wayland/SDL_waylandmessagebox.c
index 50869a54a..56388b905 100644
--- a/src/video/wayland/SDL_waylandmessagebox.c
+++ b/src/video/wayland/SDL_waylandmessagebox.c
@@ -150,9 +150,11 @@ Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
 
     /* Check which button got pressed */
     for (i = 0; i < messageboxdata->numbuttons; i += 1) {
-        if (SDL_strcmp(output, messageboxdata->buttons[i].text) == 0) {
-            *buttonid = i;
-            break;
+        if (messageboxdata->buttons[i].text != NULL) {
+            if (SDL_strcmp(output, messageboxdata->buttons[i].text) == 0) {
+                *buttonid = i;
+                break;
+            }
         }
     }