Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
XGetWindowProperty() can report success but still give you a NULL poi…
…nter.

Thanks to Joseph Toppi for the fix!
  • Loading branch information
icculus committed Oct 22, 2011
1 parent 0d9b685 commit ff5f68c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/x11/SDL_x11window.c
Expand Up @@ -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("");
Expand Down

0 comments on commit ff5f68c

Please sign in to comment.