Change explain indent count to saturating sub in cli/app.rs to prevent overflow

This commit is contained in:
PThorpe92 2025-11-26 11:10:15 -05:00
parent 95d10ce047
commit 2a415ebdb9
No known key found for this signature in database
GPG key ID: 04207EC75923D3E6

View file

@ -883,13 +883,13 @@ impl Limbo {
}
match curr_insn {
"Next" | "SorterNext" | "Prev" => indent_count - 1,
"Next" | "SorterNext" | "Prev" => indent_count.saturating_sub(1),
"Return" => {
let matching_begin_subrtn =
unclosed_begin_subrtns.iter().position(|b| b == p1);
if let Some(matching_begin_subrtn) = matching_begin_subrtn {
unclosed_begin_subrtns.remove(matching_begin_subrtn);
indent_count - 1
indent_count.saturating_sub(1)
} else {
indent_count
}