SDL_windowsmessagebox.c: go back to hg rev 14458 state. encountering a NULL caption in AddDialogString() is intended, i.e. AddDialogStaticIcon() sends it as NULL on purpose.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/src/video/windows/SDL_windowsmessagebox.c b/src/video/windows/SDL_windowsmessagebox.c
index 5bf464f..3382a2d 100644
--- a/src/video/windows/SDL_windowsmessagebox.c
+++ b/src/video/windows/SDL_windowsmessagebox.c
@@ -256,6 +256,10 @@ 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;
@@ -314,7 +318,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 && caption[0])) {
+ if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption != NULL)) {
if (!AddDialogString(dialog, caption)) {
return SDL_FALSE;
}
@@ -581,7 +585,6 @@ WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
/* Jan 25th, 2013 - dant@fleetsa.com
*
- *
* I've tried to make this more reasonable, but I've run in to a lot
* of nonsense.
*
@@ -606,8 +609,6 @@ WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
*
* Honestly, a long term solution is to use CreateWindow, not CreateDialog.
*
-
- *
* In order to get text dimensions we need to have a DC with the desired font.
* I'm assuming a dialog box in SDL is rare enough we can to the create.
*/