diff options
author | Blaž Hrastnik | 2021-11-30 08:59:30 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-30 08:59:30 +0000 |
commit | d906911417478fe98900730db856e3a7dffe6ea0 (patch) | |
tree | 11bd0c8c8cd44da8648135cf33218b6253916199 | |
parent | 30ac5869dfc514696085063f5c84d4be1aebf781 (diff) |
dap: Prevent crashes on files with no name or breakpoints
-rw-r--r-- | helix-view/src/gutter.rs | 10 |
1 files 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 |