gettextprop: check result of XGetTextProperty (undefined behaviour for XFree)
99f78fa5
1 file(s) · +1 −2
| 910 | 910 | if (!text || size == 0) |
|
| 911 | 911 | return 0; |
|
| 912 | 912 | text[0] = '\0'; |
|
| 913 | - | XGetTextProperty(dpy, w, &name, atom); |
|
| 914 | - | if (!name.nitems) |
|
| 913 | + | if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems) |
|
| 915 | 914 | return 0; |
|
| 916 | 915 | if (name.encoding == XA_STRING) |
|
| 917 | 916 | strncpy(text, (char *)name.value, size - 1); |