application/window.c

changeset 34
98e041f2f9a2
parent 33
cdeb0dc47ef5
child 36
9f3448a10d11
--- 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