Просмотр исходного кода

NULL passed to strcmp in Wayland_ShowMessageBox

meyraud705 4 лет назад
Родитель
Сommit
413a2306bc
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      src/video/wayland/SDL_waylandmessagebox.c

+ 5 - 3
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;
+            }
         }
     }