Treat string meta value "" the same as NULL
This commit is contained in:
parent
81250720de
commit
98c87e7ca9
1 changed files with 6 additions and 1 deletions
|
@ -527,17 +527,22 @@ katze_item_set_meta_data_value (KatzeItem* item,
|
||||||
* Return value: a string, or %NULL
|
* Return value: a string, or %NULL
|
||||||
*
|
*
|
||||||
* Since: 0.1.8
|
* Since: 0.1.8
|
||||||
|
*
|
||||||
|
* Since 0.4.4 "" is treated like %NULL.
|
||||||
**/
|
**/
|
||||||
const gchar*
|
const gchar*
|
||||||
katze_item_get_meta_string (KatzeItem* item,
|
katze_item_get_meta_string (KatzeItem* item,
|
||||||
const gchar* key)
|
const gchar* key)
|
||||||
{
|
{
|
||||||
|
const gchar* value;
|
||||||
|
|
||||||
g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
|
g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
|
||||||
g_return_val_if_fail (key != NULL, NULL);
|
g_return_val_if_fail (key != NULL, NULL);
|
||||||
|
|
||||||
if (g_str_has_prefix (key, "midori:"))
|
if (g_str_has_prefix (key, "midori:"))
|
||||||
key = &key[7];
|
key = &key[7];
|
||||||
return g_hash_table_lookup (item->metadata, key);
|
value = g_hash_table_lookup (item->metadata, key);
|
||||||
|
return value && *value ? value : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue