From 12214ae41577bf5820286122223da968d99d06a6 Mon Sep 17 00:00:00 2001 From: TestingPlant <44930139+TestingPlant@users.noreply.github.com> Date: Sat, 3 May 2025 20:03:24 +0000 Subject: [PATCH] fix: use saturating_add on received_movement_packets Without saturating_add, the server may panic if it receives too many movement packets within one tick. --- crates/hyperion/src/simulation/handlers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/hyperion/src/simulation/handlers.rs b/crates/hyperion/src/simulation/handlers.rs index 7e176988..87e95742 100644 --- a/crates/hyperion/src/simulation/handlers.rs +++ b/crates/hyperion/src/simulation/handlers.rs @@ -89,7 +89,7 @@ fn change_position_or_correct_client( .set(PendingTeleportation::new(pose.position)); } query.view.get::<&mut MovementTracking>(|tracking| { - tracking.received_movement_packets += 1; + tracking.received_movement_packets = tracking.received_movement_packets.saturating_add(1); let y_delta = proposed.y - pose.y; if y_delta > 0. && tracking.was_on_ground && !on_ground {