Skip to content
TypeScript

Guard worktree cleanup on missing project

Julius Marminge8a4fed1bf2dc
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 82b348936c4..349034fdcf6 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -298,13 +298,13 @@ export default function Sidebar() {
dispatch({ type: "DELETE_THREAD", threadId });
- if (!shouldDeleteWorktree || !orphanedWorktreePath) {
+ if (!shouldDeleteWorktree || !orphanedWorktreePath || !threadProject) {
return;
}
try {
await api.git.removeWorktree({
- cwd: threadProject?.cwd ?? orphanedWorktreePath,
+ cwd: threadProject.cwd,
path: orphanedWorktreePath,
});
} catch {