src/kv_list.c

changeset 1383
3db28cb1e5ec
parent 1382
f61119884dcd
--- a/src/kv_list.c	Sat Sep 20 12:27:36 2025 +0200
+++ b/src/kv_list.c	Sat Sep 20 12:30:07 2025 +0200
@@ -471,8 +471,12 @@
     }
 
     // check if the key is already assigned
-    if (kv_list->map_methods->get(&kv_list->map->map_base.base, key) != NULL) {
-        // key is already assigned, we disallow re-assignment
+    void *existing = kv_list->map_methods->get(&kv_list->map->map_base.base, key);
+    if (existing == node_data) {
+        return 0; // nothing to do
+    }
+    if (existing != NULL) {
+        // the key is already assigned to another node, we disallow re-assignment
         return 1;
     }
 

mercurial