From d906911417478fe98900730db856e3a7dffe6ea0 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Tue, 30 Nov 2021 17:59:30 +0900 Subject: 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 ab5c6d16..1ee84d43 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 -- cgit v1.2.3-70-g09d2