dap: Remove some unwraps

pull/574/head
Blaž Hrastnik 3 years ago
parent ffc89e483b
commit 573cb39926

@ -388,9 +388,10 @@ impl Application {
}
Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => match &reason[..] {
"new" => {
if let Some(source) = breakpoint.source {
self.editor
.breakpoints
.entry(breakpoint.source.unwrap().path.unwrap()) // TODO: no unwraps
.entry(source.path.unwrap()) // TODO: no unwraps
.or_default()
.push(Breakpoint {
id: breakpoint.id,
@ -401,6 +402,7 @@ impl Application {
..Default::default()
});
}
}
"changed" => {
for breakpoints in self.editor.breakpoints.values_mut() {
if let Some(i) = breakpoints.iter().position(|b| b.id == breakpoint.id)

@ -78,9 +78,10 @@ pub fn jump_to_stack_frame(editor: &mut Editor, frame: &helix_dap::StackFrame) {
return;
};
editor
.open(path, helix_view::editor::Action::Replace)
.unwrap(); // TODO: there should be no unwrapping!
if let Err(e) = editor.open(path, helix_view::editor::Action::Replace) {
editor.set_error(format!("Unable to jump to stack frame: {}", e));
return;
}
let (view, doc) = current!(editor);

Loading…
Cancel
Save