From 24a544ae09318fa2ecc48320dcfdd5023c5f085a Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 23 Jan 2025 12:45:11 -0500 Subject: [PATCH] Remove unwrap in GitTraversal::synchronize_statuses (#23559) This is a backport of https://github.com/zed-industries/zed/pull/23555 to Stable, as we couldn't cherry-pick the fix cleanly. Release Notes: - Fixed a potential panic in handling of Git statuses. --- crates/worktree/src/worktree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 3f8c113db674c7c988f6992b6a0730361d175f41..6c3b30740b67813c721b4347f7341ac2dc72dd16 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -5794,7 +5794,7 @@ 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_status = Some(statuses.item().unwrap().combined_status()); + self.current_entry_status = statuses.item().map(|item| item.combined_status()); } } }