mirror of
https://github.com/encounter/SDL.git
synced 2025-12-13 15:16:13 +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:
@@ -256,10 +256,6 @@ static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string)
|
||||
size_t count;
|
||||
SDL_bool status;
|
||||
|
||||
if (!string) {
|
||||
string = "";
|
||||
}
|
||||
|
||||
wstring = WIN_UTF8ToString(string);
|
||||
if (!wstring) {
|
||||
return SDL_FALSE;
|
||||
@@ -318,7 +314,7 @@ static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style,
|
||||
if (!AddDialogData(dialog, &type, sizeof(type))) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption != NULL)) {
|
||||
if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption != NULL && caption[0])) {
|
||||
if (!AddDialogString(dialog, caption)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user