From 082558db334a048eef25bbd196f880cb4acdb0b2 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 20 Nov 2020 12:20:02 +0300 Subject: [PATCH] SDL_os2messagebox.c (_makeDlg): fix crash if title and/or message is NULL. c.f.: bug #5253. --- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 0 src/video/os2/SDL_os2messagebox.c | 7 +++++-- 2 files changed, 5 insertions(+), 2 deletions(-) mode change 100755 => 100644 Xcode/SDL/SDL.xcodeproj/project.pbxproj 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 e3b92672d..e82b8d30c 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;