Don't push to selection history if selections are empty (#32433)
I got a panic during undo but haven't been able to repro it. Potentially a consequence of my changes in #31731 > Thread "main" panicked with "There must be at least one selection" at crates/editor/src/selections_collection.rs Leaving release notes blank as I'm not sure this actually fixes the panic Release Notes: - N/A
This commit is contained in:
parent
6070aea6c0
commit
08210b512d
1 changed files with 7 additions and 0 deletions
|
@ -1244,6 +1244,13 @@ impl SelectionHistory {
|
||||||
transaction_id: TransactionId,
|
transaction_id: TransactionId,
|
||||||
selections: Arc<[Selection<Anchor>]>,
|
selections: Arc<[Selection<Anchor>]>,
|
||||||
) {
|
) {
|
||||||
|
if selections.is_empty() {
|
||||||
|
log::error!(
|
||||||
|
"SelectionHistory::insert_transaction called with empty selections. Caller: {}",
|
||||||
|
std::panic::Location::caller()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.selections_by_transaction
|
self.selections_by_transaction
|
||||||
.insert(transaction_id, (selections, None));
|
.insert(transaction_id, (selections, None));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue