diff --git a/include/SDL_compat.h b/include/SDL_compat.h index 1b9a1c295..7ab9d9cb9 100644 --- a/include/SDL_compat.h +++ b/include/SDL_compat.h @@ -147,7 +147,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface * surface); extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); -extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); +extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title, const char **icon); extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask); extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface); diff --git a/src/SDL_compat.c b/src/SDL_compat.c index ecead67b6..0515f2a19 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -692,14 +692,17 @@ SDL_WM_SetCaption(const char *title, const char *icon) { if (wm_title) { SDL_free(wm_title); - } else { + } + if (title) { wm_title = SDL_strdup(title); + } else { + wm_title = NULL; } SDL_SetWindowTitle(SDL_VideoWindow, wm_title); } void -SDL_WM_GetCaption(char **title, char **icon) +SDL_WM_GetCaption(const char **title, const char **icon) { if (title) { *title = wm_title;