Do not crash when icon themes do not have a context

The Context key is not mandatory, so we need to handle its absence.

Fixes: #2111
This commit is contained in:
Emmanuele Bassi 2019-11-13 15:04:42 +00:00
parent 9e72ec1c8a
commit 21cd322df9

View File

@ -3204,8 +3204,12 @@ theme_list_contexts (IconTheme *theme,
{
dir = l->data;
context = g_quark_to_string (dir->context);
g_hash_table_replace (contexts, (gpointer) context, NULL);
/* The "Context" key can be unset */
if (dir->context != 0)
{
context = g_quark_to_string (dir->context);
g_hash_table_replace (contexts, (gpointer) context, NULL);
}
l = l->next;
}