dav/tags.c

changeset 769
24b317ce5ca9
parent 768
eb495f3d4065
child 785
645f7e802873
--- a/dav/tags.c	Sun Jul 02 11:03:37 2023 +0200
+++ b/dav/tags.c	Sun Jul 02 11:06:14 2023 +0200
@@ -428,25 +428,30 @@
     new_tags->simple_destructor = (cx_destructor_func)free_dav_tag;
 
     // add all local tags
-    CxIterator iter = cxListIterator(tags1);
-    cx_foreach(DavTag*, t, iter) {
-        cxMapPut(tag_map, cx_hash_key_str(t->name), t);
-        DavTag *newt = calloc(1, sizeof(DavTag));
-        newt->color = t->color ? strdup(t->color) : NULL;
-        newt->name = strdup(t->name);
-        cxListAdd(new_tags, newt);
-    }
-    // check if a remote tag is already in the map
-    // and if not add it to the new taglist
-    iter = cxListIterator(tags2);
-    cx_foreach(DavTag*, t, iter) {
-        if(!cxMapGet(tag_map, cx_hash_key_str(t->name))) {
+    if(tags1) {
+        CxIterator iter = cxListIterator(tags1);
+        cx_foreach(DavTag*, t, iter) {
+            cxMapPut(tag_map, cx_hash_key_str(t->name), t);
             DavTag *newt = calloc(1, sizeof(DavTag));
             newt->color = t->color ? strdup(t->color) : NULL;
             newt->name = strdup(t->name);
             cxListAdd(new_tags, newt);
         }
     }
+   
+    // check if a remote tag is already in the map
+    // and if not add it to the new taglist
+    if(tags2) {
+        CxIterator iter = cxListIterator(tags2);
+        cx_foreach(DavTag*, t, iter) {
+            if(!cxMapGet(tag_map, cx_hash_key_str(t->name))) {
+                DavTag *newt = calloc(1, sizeof(DavTag));
+                newt->color = t->color ? strdup(t->color) : NULL;
+                newt->name = strdup(t->name);
+                cxListAdd(new_tags, newt);
+            }
+        }
+    }
 
     cxMapDestroy(tag_map);
 

mercurial