From cb30fd3229ac79e6e6524769c87347522dc85c51 Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Fri, 25 Jul 2025 17:41:48 +0200 Subject: [PATCH] fix: overflow when incrementing dice_roll_count --- store/src/game.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/store/src/game.rs b/store/src/game.rs index fe2762f..d500342 100644 --- a/store/src/game.rs +++ b/store/src/game.rs @@ -610,7 +610,9 @@ impl GameState { fn inc_roll_count(&mut self, player_id: PlayerId) { self.players.get_mut(&player_id).map(|p| { - p.dice_roll_count += 1; + if p.dice_roll_count < u8::MAX { + p.dice_roll_count += 1; + } p }); }