From ff5f68ce61589dc8e3e8ea626f25a9dbb93a6c09 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 22 Oct 2011 02:13:35 -0400 Subject: [PATCH] XGetWindowProperty() can report success but still give you a NULL pointer. Thanks to Joseph Toppi for the fix! --- src/video/x11/SDL_x11window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 57c19fecc..538c0728c 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -593,14 +593,14 @@ X11_GetWindowTitle(_THIS, Window xwindow) status = XGetWindowProperty(display, xwindow, data->_NET_WM_NAME, 0L, 8192L, False, data->UTF8_STRING, &real_type, &real_format, &items_read, &items_left, &propdata); - if (status == Success) { + if (status == Success && propdata) { title = SDL_strdup(SDL_static_cast(char*, propdata)); XFree(propdata); } else { status = XGetWindowProperty(display, xwindow, XA_WM_NAME, 0L, 8192L, False, XA_STRING, &real_type, &real_format, &items_read, &items_left, &propdata); - if (status == Success) { + if (status == Success && propdata) { title = SDL_iconv_string("UTF-8", "", SDL_static_cast(char*, propdata), items_read+1); } else { title = SDL_strdup("");