Commit Diff


commit - c577a9cecea0c94f30a1e650e6e332fb8b43b9f6
commit + 3f17dee4f66ddd410b6ab5a184e3a8c3608d3892
blob - 686a315559b212e3c9a0e54239e92de274a498b4
blob + c15d384d2c146fcd939be25190f8eb596b845ca2
--- lib/worktree.c
+++ lib/worktree.c
@@ -2362,7 +2362,7 @@ got_worktree_resolve_path(char **wt_path, struct got_w
 
 	/* XXX status walk can't deal with trailing slash! */
 	len = strlen(path);
-	while (path[len - 1] == '/') {
+	while (len > 0 && path[len - 1] == '/') {
 		path[len - 1] = '\0';
 		len--;
 	}