From d906911417478fe98900730db856e3a7dffe6ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 30 Nov 2021 17:59:30 +0900 Subject: [PATCH] dap: Prevent crashes on files with no name or breakpoints --- helix-view/src/gutter.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs index ab5c6d168..1ee84d437 100644 --- a/helix-view/src/gutter.rs +++ b/helix-view/src/gutter.rs @@ -109,10 +109,12 @@ pub fn breakpoints<'doc>( let error = theme.get("error"); let info = theme.get("info"); - let breakpoints = doc - .path() - .and_then(|path| editor.breakpoints.get(path)) - .unwrap(); + let breakpoints = doc.path().and_then(|path| editor.breakpoints.get(path)); + + let breakpoints = match breakpoints { + Some(breakpoints) => breakpoints, + None => return Box::new(move |_, _, _| None), + }; Box::new(move |line: usize, _selected: bool, out: &mut String| { let breakpoint = breakpoints