Skip to content

Commit

Permalink
saturating_sub on credit update
Browse files Browse the repository at this point in the history
  • Loading branch information
kallsyms committed Jan 6, 2025
1 parent 7d35a7c commit d3ace3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,8 @@ impl App {
}
if let Some(credits_used) = credits_used {
let mut credit_remaining = credit_remaining.lock().unwrap();
*credit_remaining -= credits_used;
*credit_remaining =
(*credit_remaining).saturating_sub(credits_used);
}

revert(repo_path).unwrap();
Expand Down Expand Up @@ -2257,6 +2258,7 @@ impl App {
/feedback <DESCRIPTION>: Send us feedback
/diff: Review the last diff Bismuth made
/refill: Open billing page to refill credits
/quit or Ctrl+C: Exit the chat
/help: Show this help"#
.to_string(),
);
Expand Down

0 comments on commit d3ace3d

Please sign in to comment.