xutil: check for text and len

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-31 08:55:15 +02:00
parent 3e325782de
commit e2de0270b2
1 changed files with 18 additions and 15 deletions

View File

@ -59,10 +59,12 @@ xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
return false;
}
if(text && len)
{
/* Check whether the returned property value is just an ascii
* string or utf8 string. At the moment it doesn't handle
* COMPOUND_TEXT and multibyte but it's not needed... */
if(text && (prop_r->type == STRING || prop_r->type == UTF8_STRING))
if(prop_r->type == STRING || prop_r->type == UTF8_STRING)
{
void *prop_val = xcb_get_property_value(prop_r);
*text = p_new(char, prop_r->value_len + 1);
@ -76,6 +78,7 @@ xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
*text = NULL;
*len = 0;
}
}
p_delete(&prop_r);
return true;