From 04639715df2bc9e40651950b382400ab256baf9d Mon Sep 17 00:00:00 2001 From: Jan1k Date: Sat, 20 Jun 2026 20:27:54 +0200 Subject: [PATCH] fix: prevent statistic overflow panics (#2271) --- pumpkin/src/entity/player/statistics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pumpkin/src/entity/player/statistics.rs b/pumpkin/src/entity/player/statistics.rs index d4cda6a9c..6d97233b5 100644 --- a/pumpkin/src/entity/player/statistics.rs +++ b/pumpkin/src/entity/player/statistics.rs @@ -12,7 +12,7 @@ pub struct Statistics { impl Statistics { pub fn increment(&mut self, category: StatisticCategory, stat: i32, amount: i32) { let entry = self.stats.entry((category as i32, stat)).or_insert(0); - *entry += amount; + *entry = entry.saturating_add(amount); } pub fn increment_custom(&mut self, stat: CustomStatistic, amount: i32) {