From 0e5159ceca6be34977349156a32cc1a3ec53ab6e Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Wed, 18 Jan 2023 22:28:47 +0100 Subject: Fix panic for noop selecting join (#5579) --- helix-term/src/commands.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'helix-term/src') 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(); -- cgit v1.2.3-70-g09d2