prevent array access with negative index in got_worktree_resolve_path()
diff --git a/lib/worktree.c b/lib/worktree.c
index 686a315..c15d384 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -2362,7 +2362,7 @@ got_worktree_resolve_path(char **wt_path, struct got_worktree *worktree,
/* 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--;
}