Don't crash if removing a nonexistent value.
[platform/upstream/glib.git] / gcache.c
index 145a093..dc58f07 100644 (file)
--- a/gcache.c
+++ b/gcache.c
@@ -157,6 +157,9 @@ g_cache_remove (GCache   *cache,
   key = g_hash_table_lookup (rcache->value_table, value);
   node = g_hash_table_lookup (rcache->key_table, key);
 
+  if (node == NULL)
+    return;
+
   node->ref_count -= 1;
   if (node->ref_count == 0)
     {