1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Return NULL when empty property.

This commit is contained in:
Dave Davenport 2016-03-04 19:41:32 +01:00
parent fa7ceaf580
commit 881ca572df
2 changed files with 13 additions and 8 deletions

View file

@ -89,11 +89,14 @@ char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom )
xcb_get_property_cookie_t c = xcb_get_property ( xcb->connection, 0, w, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, UINT_MAX );
xcb_get_property_reply_t *r = xcb_get_property_reply ( xcb->connection, c, NULL );
if ( r ) {
char *str = g_malloc ( xcb_get_property_value_length ( r ) + 1 );
memcpy ( str, xcb_get_property_value ( r ), xcb_get_property_value_length ( r ) );
str[xcb_get_property_value_length ( r )] = '\0';
if ( xcb_get_property_value_length ( r ) > 0 ) {
char *str = g_malloc ( xcb_get_property_value_length ( r ) + 1 );
memcpy ( str, xcb_get_property_value ( r ), xcb_get_property_value_length ( r ) );
str[xcb_get_property_value_length ( r )] = '\0';
free ( r );
return str;
}
free ( r );
return str;
}
return NULL;
}

View file

@ -333,10 +333,12 @@ static void __config_parse_xresource_options_dynamic ( XrmDatabase xDB )
void config_parse_xresource_options_dynamic ( xcb_stuff *xcb )
{
char *name = window_get_text_prop ( xcb_stuff_get_root_window ( xcb ), XCB_ATOM_RESOURCE_MANAGER );
XrmDatabase xDB = XrmGetStringDatabase ( name );
__config_parse_xresource_options_dynamic ( xDB );
XrmDestroyDatabase ( xDB );
g_free ( name );
if ( name ) {
XrmDatabase xDB = XrmGetStringDatabase ( name );
__config_parse_xresource_options_dynamic ( xDB );
XrmDestroyDatabase ( xDB );
g_free ( name );
}
}
void config_parse_xresource_options_dynamic_file ( const char *filename )
{