[Xfce4-commits] <thunar:master> Fix assert when a desktop file is loaded with an empty icon key.
Nick Schermer
nick at xfce.org
Sun Aug 30 14:12:02 CEST 2009
Updating branch refs/heads/master
to e8b1b1da85c3a69727ead62f006989fe0752ed46 (commit)
from 4b9bfb00d2516e07404abf1e72f61820f8d032b6 (commit)
commit e8b1b1da85c3a69727ead62f006989fe0752ed46
Author: Nick Schermer <nick at xfce.org>
Date: Sun Aug 30 14:11:13 2009 +0200
Fix assert when a desktop file is loaded with an empty icon key.
thunar/thunar-file.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index f02d34a..202d31c 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -712,7 +712,7 @@ thunar_file_load (ThunarFile *file,
gchar *base_name;
gchar *md5_hash;
gchar *thumbnail_dir_path;
- gchar *uri = NULL;
+ gchar *uri = NULL, *p;
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
_thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -808,13 +808,19 @@ thunar_file_load (ThunarFile *file,
G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_ICON,
NULL);
-
- if (file->custom_icon_name != NULL && *file->custom_icon_name != '\0')
+
+ if (G_UNLIKELY (exo_str_is_empty (file->custom_icon_name)))
+ {
+ /* make sure we set null if the string is empty else
+ * thunar_icon_factory_lookup_icon() will assert */
+ g_free (file->custom_icon_name);
+ file->custom_icon_name = NULL;
+ }
+ else
{
/* drop any suffix (e.g. '.png') from themed icons */
if (!g_path_is_absolute (file->custom_icon_name))
{
- gchar *p;
p = strrchr (file->custom_icon_name, '.');
if (p != NULL)
*p = '\0';
More information about the Xfce4-commits
mailing list