Sun, 02 Jul 2023 10:48:27 +0200
fix tag filter crash
dav/sync.c | file | annotate | diff | comparison | revisions | |
dav/tags.c | file | annotate | diff | comparison | revisions |
--- a/dav/sync.c Sun Jul 02 10:37:44 2023 +0200 +++ b/dav/sync.c Sun Jul 02 10:48:27 2023 +0200 @@ -469,9 +469,11 @@ DavBool changed = 0; CxList *res_tags = sync_get_file_tags(dir, res, &changed, NULL); + if(!res_tags) { + res_tags = cxEmptyList; + } int ret = matches_tagfilter(res_tags, tagfilter); - CxIterator i = cxListIterator(res_tags); cxListDestroy(res_tags); return ret; }
--- a/dav/tags.c Sun Jul 02 10:37:44 2023 +0200 +++ b/dav/tags.c Sun Jul 02 10:48:27 2023 +0200 @@ -110,6 +110,10 @@ } CxMap* taglist2map(CxList *tags) { + if(!tags) { + return cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8); + } + CxMap *map = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, tags->size + 8); CxIterator iter = cxListIterator(tags); cx_foreach(DavTag*, t, iter) {