diff options
author | Matt | 2024-02-16 14:43:14 +0000 |
---|---|---|
committer | GitHub | 2024-02-16 14:43:14 +0000 |
commit | 76e512f9445b2a26655248b46cf13413f9a6bbba (patch) | |
tree | ea276af49d8cd525b1dd29e3da73484d2a2abce6 /helix-view/src/handlers | |
parent | 59369d99e2ed891206bd63c9b83b034da474920a (diff) |
Remove unwrap on line option, preventing DAP crash (#9632)
* Remove unwrap on line option, preventing DAP crash, ref #4683
* Update to fall back to existing values for option fields
Diffstat (limited to 'helix-view/src/handlers')
-rw-r--r-- | helix-view/src/handlers/dap.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/helix-view/src/handlers/dap.rs b/helix-view/src/handlers/dap.rs index e1437bef..a5fa0c29 100644 --- a/helix-view/src/handlers/dap.rs +++ b/helix-view/src/handlers/dap.rs @@ -226,10 +226,15 @@ impl Editor { breakpoints.iter().position(|b| b.id == breakpoint.id) { breakpoints[i].verified = breakpoint.verified; - breakpoints[i].message = breakpoint.message.clone(); - breakpoints[i].line = - breakpoint.line.unwrap().saturating_sub(1); // TODO: no unwrap - breakpoints[i].column = breakpoint.column; + breakpoints[i].message = breakpoint + .message + .clone() + .or_else(|| breakpoints[i].message.take()); + breakpoints[i].line = breakpoint + .line + .map_or(breakpoints[i].line, |line| line.saturating_sub(1)); + breakpoints[i].column = + breakpoint.column.or(breakpoints[i].column); } } } |