From aa4d0b464645b2834d7af483d17fdc11d61d994d Mon Sep 17 00:00:00 2001 From: ath3 <45574139+ath3@users.noreply.github.com> Date: Thu, 4 Nov 2021 09:57:04 +0100 Subject: [PATCH] Fix crash on changing from empty scratch buffer to itself (#975) --- helix-view/src/editor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 633e2541..63a4ab29 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -240,6 +240,8 @@ impl Editor { let remove_empty_scratch = !doc.is_modified() // If the buffer has no path and is not modified, it is an empty scratch buffer. && doc.path().is_none() + // If the buffer we are changing to is not this buffer + && id != doc.id // Ensure the buffer is not displayed in any other splits. && !self .tree