From d4e1ec339e022ffd5073873ac0bc64e3c095d064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 28 Jun 2021 14:50:35 +0900 Subject: [PATCH] Don't crash if diagnostics span past EOF --- helix-core/src/syntax.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index d03ca6bf7..c556a3477 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -1765,6 +1765,11 @@ impl> Iterator for Merge { self.next_event = self.iter.next(); Some(event) } + // can happen if deleting and cursor at EOF, and diagnostic reaches past the end + (None, Some((span, range))) => { + self.next_span = None; + None + } (None, None) => None, e => unreachable!("{:?}", e), }