summaryrefslogtreecommitdiff
path: root/capplets/default-applications/mate-da-capplet.c
diff options
context:
space:
mode:
authorZhang Xianwei <[email protected]>2018-12-08 23:16:03 +0800
committerlukefromdc <[email protected]>2018-12-10 01:06:06 +0000
commit9482529f93ce7679fcbb350971ea8678347ab8c5 (patch)
treed27436353a9ea1855a47bb38da1f87727b134cc8 /capplets/default-applications/mate-da-capplet.c
parent08d1e4e1e600d3957f7dc2771960cc5401111456 (diff)
downloadmate-control-center-9482529f93ce7679fcbb350971ea8678347ab8c5.tar.bz2
mate-control-center-9482529f93ce7679fcbb350971ea8678347ab8c5.tar.xz
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 <[email protected]>
Diffstat (limited to 'capplets/default-applications/mate-da-capplet.c')
-rw-r--r--capplets/default-applications/mate-da-capplet.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/capplets/default-applications/mate-da-capplet.c b/capplets/default-applications/mate-da-capplet.c
index c42aca02..4eb318a3 100644
--- a/capplets/default-applications/mate-da-capplet.c
+++ b/capplets/default-applications/mate-da-capplet.c
@@ -501,12 +501,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);