From b7bc9d843a54afa1e357ff917d43aa379fb36f8a Mon Sep 17 00:00:00 2001 From: Zhang Xianwei Date: Sat, 8 Dec 2018 23:16:03 +0800 Subject: default-applications: Fix assertion failture on g_icon_to_string Prevent runtime failture on g_icon_to_string in fill_combo_box by catching the NULL case See https://github.com/mate-desktop/mate-control-center/pull/398#issuecomment-445047978 Signed-off-by: Zhang Xianwei --- capplets/default-applications/mate-da-capplet.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'capplets') diff --git a/capplets/default-applications/mate-da-capplet.c b/capplets/default-applications/mate-da-capplet.c index 450f1e9f..b3c21fb9 100644 --- a/capplets/default-applications/mate-da-capplet.c +++ b/capplets/default-applications/mate-da-capplet.c @@ -472,12 +472,16 @@ fill_combo_box(GtkIconTheme* theme, GtkComboBox* combo_box, GList* app_list, gch /* Icon */ GIcon* icon = g_app_info_get_icon(item); - gchar* icon_name = g_icon_to_string(icon); - - if (icon_name == NULL) - { - /* Default icon */ - icon_name = g_strdup("binary"); + gchar* icon_name; + + if (icon != NULL) { + icon_name = g_icon_to_string (icon); + if (icon_name == NULL) { + /* Default icon */ + icon_name = g_strdup ("binary"); + } + } else { + icon_name = g_strdup ("binary"); } pixbuf = gtk_icon_theme_load_icon(theme, icon_name, 22, 0, NULL); -- cgit v1.2.1