Updating branch refs/heads/master
         to 25538ae36acfd78eba9ce2311dacb1cf6a5cc550 (commit)
       from 52808a85c7e5d393c7189c6b722f824509f9d373 (commit)

commit 25538ae36acfd78eba9ce2311dacb1cf6a5cc550
Author: Nick Schermer <n...@xfce.org>
Date:   Sun Aug 23 22:29:38 2009 +0200

    Don't try to load data from the file if the returned length is nul.

 thunar/thunar-gio-extensions.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index f26e4ce..907b402 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -145,19 +145,20 @@ thunar_g_file_query_key_file (GFile              *file,
   key_file = g_key_file_new ();
 
   /* try to parse the key file from the contents of the file */
-  if (!g_key_file_load_from_data (key_file, contents, length, 
-                                  G_KEY_FILE_KEEP_COMMENTS 
-                                  | G_KEY_FILE_KEEP_TRANSLATIONS,
-                                  error))
+  if (G_LIKELY (length == 0
+      || g_key_file_load_from_data (key_file, contents, length,
+                                    G_KEY_FILE_KEEP_COMMENTS
+                                    | G_KEY_FILE_KEEP_TRANSLATIONS,
+                                    error)))
     {
       g_free (contents);
-      g_key_file_free (key_file);
-      return NULL;
+      return key_file;
     }
   else
     {
       g_free (contents);
-      return key_file;
+      g_key_file_free (key_file);
+      return NULL;
     }
 }
 
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to