Remove unwrap on line option, preventing DAP crash ()

* Remove unwrap on line option, preventing DAP crash, ref 

* Update to fall back to existing values for option fields
This commit is contained in:
Matt 2024-02-16 15:43:14 +01:00 committed by GitHub
parent 59369d99e2
commit 76e512f944
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}
}
}