From 75ae4dada4d9b45d736d5c71f41d4284caf698d1 Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Thu, 23 Jan 2025 12:13:20 -0500 Subject: [PATCH] Remove unwrap in GitTraversal::synchronize_statuses (#23555) Release Notes: - Fixed a potential panic in handling of Git statuses. Co-authored-by: Marshall --- crates/worktree/src/worktree.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 077248c91d2f14c3ecfddebe8bd1045d61479a0d..737e70c786105904411f9e0d52da21781ee8a51c 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -5725,7 +5725,8 @@ impl<'a> GitTraversal<'a> { } else if entry.is_file() { // For a file entry, park the cursor on the corresponding status if statuses.seek_forward(&PathTarget::Path(repo_path.as_ref()), Bias::Left, &()) { - self.current_entry_summary = Some(statuses.item().unwrap().status.into()); + // TODO: Investigate statuses.item() being None here. + self.current_entry_summary = statuses.item().map(|item| item.status.into()); } else { self.current_entry_summary = Some(GitSummary::UNCHANGED); }