diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index f02d34a15f6a0f0705c42ea78536adc2041ef6a8..202d31cdc4e1f2a7d5bc7a92932b1dba58f08be6 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';