From 67bbd65d6c9eeef23d41a569b003fb4ed7bf4eaf Mon Sep 17 00:00:00 2001 From: SoraTenshi Date: Sat, 12 Aug 2023 19:50:59 +0200 Subject: [PATCH] Fix a crash when there's no cursor cache --- helix-term/src/ui/context.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/context.rs b/helix-term/src/ui/context.rs index 5b5278ad3..5e2e6cf19 100644 --- a/helix-term/src/ui/context.rs +++ b/helix-term/src/ui/context.rs @@ -73,7 +73,10 @@ pub fn calculate_sticky_nodes( config: &helix_view::editor::Config, cursor_cache: &Option>, ) -> Option> { - let cursor_cache = cursor_cache.expect("cursor is cached")?; + let Some(cursor_cache) = cursor_cache else { + return None; + }; + let cursor_cache = cursor_cache.as_ref()?; let syntax = doc.syntax()?; let tree = syntax.tree();