aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-term/src/commands.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 5b3ce68e..8b742d00 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3939,6 +3939,11 @@ fn join_selections_impl(cx: &mut Context, select_space: bool) {
}
}
+ // nothing to do, bail out early to avoid crashes later
+ if changes.is_empty() {
+ return;
+ }
+
changes.sort_unstable_by_key(|(from, _to, _text)| *from);
changes.dedup();