Skip to content

fix: add missing return in loadWorktrees and bounds check in status parser#5369

Open
mango766 wants to merge 1 commit intojesseduffield:masterfrom
mango766:fix/worktree-load-and-status-parse-safety
Open

fix: add missing return in loadWorktrees and bounds check in status parser#5369
mango766 wants to merge 1 commit intojesseduffield:masterfrom
mango766:fix/worktree-load-and-status-parse-safety

Conversation

@mango766
Copy link

Two small defensive fixes:

  1. refresh_helper.go: Added missing return in loadWorktrees error path. Without it, the empty-slice fallback was immediately overwritten by the nil worktrees value.

  2. file_loader.go: Added bounds check before accessing splitLines[i+1] in the rename/copy status parser to prevent panic on truncated git output.

Closes #5368

…arser

1. refresh_helper.go: Added missing `return` in loadWorktrees error path.
   Without it, the empty-slice fallback was immediately overwritten by
   the nil worktrees value from the failed GetWorktrees() call.

2. file_loader.go: Added bounds check before accessing splitLines[i+1]
   in the rename/copy status parser to prevent index out-of-bounds panic
   on truncated git output.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing return in loadWorktrees + out-of-bounds risk in status parser

1 participant