mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
fix bug #5253: handle NULL title or message fields in SDL_MessageBoxData
- SDL_video.c (SDL_ShowMessageBox): replace messageboxdata, set title or message field to "" if either of them is NULL. - SDL_video.c (SDL_ShowSimpleMessageBox): set title or message to "" if either of them is NULL for EMSCRIPTEN builds. - SDL_bmessagebox.cc: add empty string check along with NULL check for title and message fields. - SDL_windowsmessagebox.c (AddDialogString): remove NULL string check - SDL_windowsmessagebox.c (AddDialogControl): add empty string check along with the NULL check. - SDL_x11messagebox.c: revert commit 677c4cd68069 - SDL_os2messagebox.c: revert commit 2c2a489d76e7 - test/testmessage.c: Add NULL title and NULL message tests.
This commit is contained in:
@@ -106,6 +106,24 @@ main(int argc, char *argv[])
|
||||
quit(1);
|
||||
}
|
||||
|
||||
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||
NULL,
|
||||
"NULL Title",
|
||||
NULL);
|
||||
if (success == -1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
|
||||
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||
"NULL Message",
|
||||
NULL,
|
||||
NULL);
|
||||
if (success == -1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
|
||||
quit(1);
|
||||
}
|
||||
|
||||
/* Google says this is Traditional Chinese for "beef with broccoli" */
|
||||
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||
"UTF-8 Simple MessageBox",
|
||||
|
||||
Reference in New Issue
Block a user