fix dav path separator function

Sun, 09 Jun 2024 16:43:40 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 09 Jun 2024 16:43:40 +0200
changeset 34
98e041f2f9a2
parent 33
cdeb0dc47ef5
child 35
834d9c15a69f

fix dav path separator function

application/window.c file | annotate | diff | comparison | revisions
--- a/application/window.c	Sun Jun 09 16:06:40 2024 +0200
+++ b/application/window.c	Sun Jun 09 16:43:40 2024 +0200
@@ -139,12 +139,15 @@
 	cxstring path = cx_strsubs(fpath, end+skip);
 
 	cxstring *pathelms;
-	size_t nelm = cx_strsplit_a(cxDefaultAllocator, path, CX_STR("/"), 4096, &pathelms);
-
-	if (nelm == 0) {
-		*ret_nelm = 0;
-		return NULL;
-	}
+	size_t nelm = 0;
+        
+        if(path.length > 0) {
+            nelm = cx_strsplit_a(cxDefaultAllocator, path, CX_STR("/"), 4096, &pathelms);
+            if (nelm == 0) {
+                    *ret_nelm = 0;
+                    return NULL;
+            }
+        }
 
 	UiPathElm* elms = (UiPathElm*)calloc(nelm + 1, sizeof(UiPathElm));
 	size_t n = nelm + 1;

mercurial