[Xfce4-commits] <midori:master> Treat string meta value "" the same as NULL

Christian Dywan noreply at xfce.org
Tue Jan 3 21:38:01 CET 2012


Updating branch refs/heads/master
         to 98c87e7ca9591b2878ebf45fab9b6e3bdec66652 (commit)
       from 81250720de8e60f23b92f2598cb3565ba2c41200 (commit)

commit 98c87e7ca9591b2878ebf45fab9b6e3bdec66652
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Jan 3 21:28:45 2012 +0100

    Treat string meta value "" the same as NULL

 katze/katze-item.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/katze/katze-item.c b/katze/katze-item.c
index 1d3a3ee..ed54857 100644
--- a/katze/katze-item.c
+++ b/katze/katze-item.c
@@ -527,17 +527,22 @@ katze_item_set_meta_data_value (KatzeItem*   item,
  * Return value: a string, or %NULL
  *
  * Since: 0.1.8
+ *
+ * Since 0.4.4 "" is treated like %NULL.
  **/
 const gchar*
 katze_item_get_meta_string (KatzeItem*   item,
                             const gchar* key)
 {
+    const gchar* value;
+
     g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
     g_return_val_if_fail (key != NULL, NULL);
 
     if (g_str_has_prefix (key, "midori:"))
         key = &key[7];
-    return g_hash_table_lookup (item->metadata, key);
+    value = g_hash_table_lookup (item->metadata, key);
+    return value && *value ? value : NULL;
 }
 
 /**


More information about the Xfce4-commits mailing list