diff options
author | Zhang Xianwei <[email protected]> | 2018-12-08 23:16:03 +0800 |
---|---|---|
committer | monsta <[email protected]> | 2019-05-31 15:53:44 +0300 |
commit | b7bc9d843a54afa1e357ff917d43aa379fb36f8a (patch) | |
tree | 7153d8948ba13dee3b0558f8f194bdefba394d9c /capplets/default-applications/mate-da-capplet.c | |
parent | a90d154ba4c59cb3e52536a3e5196146c41f65be (diff) | |
download | mate-control-center-b7bc9d843a54afa1e357ff917d43aa379fb36f8a.tar.bz2 mate-control-center-b7bc9d843a54afa1e357ff917d43aa379fb36f8a.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.c | 16 |
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 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); |