[gthumb] catalog: create an empty catalog when the file is empty



commit da47c97a7c77b13d66c438c378e80c0a5ff4380c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Dec 16 20:46:23 2019 +0100

    catalog: create an empty catalog when the file is empty

 extensions/catalogs/gth-catalog.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/extensions/catalogs/gth-catalog.c b/extensions/catalogs/gth-catalog.c
index dfe21d3f..d4befe1b 100644
--- a/extensions/catalogs/gth-catalog.c
+++ b/extensions/catalogs/gth-catalog.c
@@ -270,11 +270,11 @@ gth_catalog_new_from_data (const void  *buffer,
        char       *text_buffer;
        GthCatalog *catalog = NULL;
 
-       if (buffer == NULL)
-               return NULL;
-
        text_buffer = (char *) buffer;
-       if (strncmp (text_buffer, "<?xml ", 6) == 0) {
+       if ((text_buffer == NULL)
+               || (*text_buffer == 0)
+               || (strncmp (text_buffer, "<?xml ", 6) == 0))
+       {
                catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", (gpointer) buffer);
                if (catalog != NULL)
                        read_catalog_data_from_xml (catalog, text_buffer, count, error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]