glocalfileinfo: Use g_strcmp0() for some comparisons which might be NULL

The return value from g_get_user_special_dir() might be NULL. Safest to
use g_strcmp0() uniformly everywhere.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=661442
This commit is contained in:
Philip Withnall 2017-10-05 13:31:10 +01:00
parent 9cbff9f768
commit 0a10f7375f

View File

@ -1618,12 +1618,12 @@ get_icon_name (const char *path,
const char *name = NULL;
gboolean with_fallbacks = TRUE;
if (strcmp (path, g_get_home_dir ()) == 0)
if (g_strcmp0 (path, g_get_home_dir ()) == 0)
{
name = use_symbolic ? "user-home-symbolic" : "user-home";
with_fallbacks = FALSE;
}
else if (strcmp (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
{
name = use_symbolic ? "user-desktop-symbolic" : "user-desktop";
with_fallbacks = FALSE;