on master help sign in
dap: Prevent crashes on files with no name or breakpoints
commitd906911417478fe98900730db856e3a7dffe6ea0 authorBlaž Hrastnik <blaz@mxxn.io> dateTue 30 Nov 2021, 17:59 (5 years ago) parent30ac586
1 file changed+6−4
helix-view/src/gutter.rs+6−4
helix-view/src/gutter.rs+6−4
@@ -109,10 +109,12 @@ pub fn breakpoints<'doc>(
109109 let error = theme.get("error");
110110 let info = theme.get("info");
111111
112− let breakpoints = doc
113− .path()
114− .and_then(|path| editor.breakpoints.get(path))
115− .unwrap();
112+ let breakpoints = doc.path().and_then(|path| editor.breakpoints.get(path));
113+
114+ let breakpoints = match breakpoints {
115+ Some(breakpoints) => breakpoints,
116+ None => return Box::new(move |_, _, _| None),
117+ };
116118
117119 Box::new(move |line: usize, _selected: bool, out: &mut String| {
118120 let breakpoint = breakpoints