Fix double-lease panic in Repository::activate (#24414)

Release Notes:

- N/A

Co-authored-by: maxbrunsfeld <max@zed.dev>
This commit is contained in:
Cole Millerandmaxbrunsfeld authored and GitHub committed 2025-02-07 00:33:41 +00:00
1 parent 090bf47bbd
commit 90d94deaa6
1 file changed
+4 -4
+4 -4
View File
@@ -314,16 +314,16 @@ impl Repository {
.unwrap_or("".into())
}
pub fn activate(&self, cx: &mut App) {
pub fn activate(&self, cx: &mut Context<Self>) {
let Some(git_state) = self.git_state.upgrade() else {
return;
};
let entity = cx.entity();
git_state.update(cx, |git_state, cx| {
let Some((index, _)) = git_state
let Some(index) = git_state
.repositories
.iter()
.enumerate()
.find(|(_, handle)| handle.read(cx).id() == self.id())
.position(|handle| *handle == entity)
else {
return;
};