diff --git a/src/dialog/unix/SDL_zenitymessagebox.c b/src/dialog/unix/SDL_zenitymessagebox.c index 01ca673d3c26d..bf9c85b07a6f6 100644 --- a/src/dialog/unix/SDL_zenitymessagebox.c +++ b/src/dialog/unix/SDL_zenitymessagebox.c @@ -158,7 +158,15 @@ bool SDL_Zenity_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu return false; } if (buttonID) { - char *output = SDL_ReadProcess(process, NULL, NULL); + int exit_code; + char *output = SDL_ReadProcess(process, NULL, &exit_code); + if (exit_code == 255) { + if (output) { + SDL_free(output); + } + SDL_DestroyProcess(process); + return false; + } if (output) { // It likes to add a newline... char *tmp = SDL_strrchr(output, '\n');