Commit 082558db334a048eef25bbd196f880cb4acdb0b2

Ozkan Sezer 2020-11-20T12:20:02

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

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
old mode 100755
new mode 100644
diff --git a/src/video/os2/SDL_os2messagebox.c b/src/video/os2/SDL_os2messagebox.c
index e3b9267..e82b8d3 100644
--- a/src/video/os2/SDL_os2messagebox.c
+++ b/src/video/os2/SDL_os2messagebox.c
@@ -205,9 +205,12 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
         pSDLBtnData =  (SDL_MessageBoxButtonData *)messageboxdata->buttons;
     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);
-    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);
 
     PDLGTEMPLATE        pTemplate;