GtkIconTheme: Make suffix_from_name NULL-safe

This can happen sometimes with GFileIcons that are
not representable as a local path. Better not to crash
in this case.
This commit is contained in:
Matthias Clasen 2014-09-05 13:15:14 -04:00
parent f66d84deec
commit 1629903943

View File

@ -2840,8 +2840,10 @@ string_from_suffix (IconSuffix suffix)
static IconSuffix
suffix_from_name (const gchar *name)
{
IconSuffix retval;
IconSuffix retval = ICON_SUFFIX_NONE;
if (name != NULL)
{
if (g_str_has_suffix (name, ".symbolic.png"))
retval = ICON_SUFFIX_SYMBOLIC_PNG;
else if (g_str_has_suffix (name, ".png"))
@ -2850,8 +2852,7 @@ suffix_from_name (const gchar *name)
retval = ICON_SUFFIX_SVG;
else if (g_str_has_suffix (name, ".xpm"))
retval = ICON_SUFFIX_XPM;
else
retval = ICON_SUFFIX_NONE;
}
return retval;
}