SDL_os2messagebox.c (_makeDlg): fix crash if title and/or message is NULL.

c.f.: bug #5253.
This commit is contained in:
Ozkan Sezer 2020-11-20 12:20:02 +03:00
parent bf7d198d48
commit 082558db33
2 changed files with 5 additions and 2 deletions

0
Xcode/SDL/SDL.xcodeproj/project.pbxproj Executable file → Normal file
View File

View File

@ -205,9 +205,12 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons; pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons;
ULONG cSDLBtnData = messageboxdata->numbuttons; ULONG cSDLBtnData = messageboxdata->numbuttons;
PSZ pszTitle = OS2_UTF8ToSys((PSZ) messageboxdata->title); PSZ pszTitle = (messageboxdata->title == NULL)? NULL :
OS2_UTF8ToSys((PSZ) messageboxdata->title);
ULONG cbTitle = (pszTitle == NULL)? 0 : strlen(pszTitle); ULONG cbTitle = (pszTitle == NULL)? 0 : strlen(pszTitle);
PSZ pszText = OS2_UTF8ToSys((PSZ) messageboxdata->message);
PSZ pszText = (messageboxdata->message == NULL)? NULL :
OS2_UTF8ToSys((PSZ) messageboxdata->message);
ULONG cbText = (pszText == NULL)? 0 : strlen(pszText); ULONG cbText = (pszText == NULL)? 0 : strlen(pszText);
PDLGTEMPLATE pTemplate; PDLGTEMPLATE pTemplate;