From ce8f574444dcc11ac762d45e218026f7a18fb394 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 22 May 2014 19:47:50 +0100 Subject: [PATCH] Check for key on p_hash_table_add --- src/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common.c b/src/common.c index e54cee6c..2d9e5183 100644 --- a/src/common.c +++ b/src/common.c @@ -81,7 +81,10 @@ p_list_free_full(GList *items, GDestroyNotify free_func) gboolean p_hash_table_add(GHashTable *hash_table, gpointer key) { - return g_hash_table_replace(hash_table, key, key); + gpointer found = g_hash_table_lookup(hash_table, key); + g_hash_table_replace(hash_table, key, key); + + return (found == NULL); } gboolean