From 41ec4645ab6cf9a13ef95c05980b860ce3a3ac01 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 27 Jan 2022 15:53:44 +0100 Subject: [PATCH] Don't panic when ending transaction that wasn't started by the same editor Co-Authored-By: Nathan Sobo --- crates/editor/src/editor.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index f16d982cc2..a3c62295f7 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -3527,7 +3527,11 @@ impl Editor { .buffer .update(cx, |buffer, cx| buffer.end_transaction_at(now, cx)) { - self.selection_history.get_mut(&tx_id).unwrap().1 = Some(self.selections.clone()); + if let Some((_, end_selections)) = self.selection_history.get_mut(&tx_id) { + *end_selections = Some(self.selections.clone()); + } else { + log::error!("unexpectedly ended a transaction that wasn't started by this editor"); + } } }