Button: make sure icon is optional

This commit is contained in:
o9000
2017-03-25 15:48:03 +01:00
parent a7fc86cfbb
commit 63dd4a3e6c
2 changed files with 8 additions and 3 deletions

View File

@@ -207,9 +207,14 @@ void button_reload_icon(Button *button)
free_icon(button->frontend->icon_hover);
free_icon(button->frontend->icon_pressed);
button->frontend->icon = NULL;
button->frontend->icon_hover = NULL;
button->frontend->icon_pressed = NULL;
button->frontend->icon_load_size = button->frontend->iconw;
if (!button->backend->icon_name)
return;
char *new_icon_path = get_icon_path(icon_theme_wrapper, button->backend->icon_name, button->frontend->iconw, TRUE);
if (new_icon_path)
button->frontend->icon = imlib_load_image_immediately(new_icon_path);