bevy/crates/bevy_ecs/src
Tristan Maindron 0f153ffb44
Prevent last_trigger_id from overflowing (#17978)
# Objective

This prevents overflowing the `last_trigger_id` property that leads to a
panic in debug mode.

```bash
panicked at C:\XXX\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.2\src\world\unsafe_world_cell.rs:630:18:
attempt to add with overflow
Encountered a panic when applying buffers for system `bevy_sprite::calculate_bounds_2d`!
Encountered a panic in system `bevy_ecs::schedule::executor::apply_deferred`!
```

## Solution

As this value is only used for detecting a change, we can wrap when it
reaches max value.

## Testing

This can be verified by running `cargo run --example observers`
2025-02-25 23:12:51 +00:00
..
entity implement UniqueEntityArray (#17954) 2025-02-24 21:36:59 +00:00
event Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
identifier Harden proc macro path resolution and add integration tests. (#17330) 2025-02-09 19:45:45 +00:00
observer Handle TriggerTargets that are combinations for components/entities (#18024) 2025-02-24 23:57:34 +00:00
query Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
reflect Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
relationship Add methods to add single entity relationships (#18038) 2025-02-25 23:07:44 +00:00
schedule Use explicitly added ApplyDeferred stages when computing automatically inserted sync points. (#16782) 2025-02-24 20:51:34 +00:00
storage Handle TriggerTargets that are combinations for components/entities (#18024) 2025-02-24 23:57:34 +00:00
system Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
world Prevent last_trigger_id from overflowing (#17978) 2025-02-25 23:12:51 +00:00
archetype.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
batching.rs Fix *most* clippy lints (#15906) 2024-10-14 20:52:35 +00:00
bundle.rs Encapsulate cfg(feature = "track_location") in a type. (#17602) 2025-02-10 21:21:20 +00:00
change_detection.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
component.rs Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
entity_disabling.rs Allow users to register their own disabling components / default query filters (#17768) 2025-02-11 18:25:32 +00:00
hierarchy.rs Improve the docs for ChildOf and Children (#17886) 2025-02-17 01:46:11 +00:00
intern.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
label.rs Fix issue with define_label! instantiation in a 3rd party crate (#17958) 2025-02-21 06:13:36 +00:00
lib.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
name.rs Harden proc macro path resolution and add integration tests. (#17330) 2025-02-09 19:45:45 +00:00
removal_detection.rs Harden proc macro path resolution and add integration tests. (#17330) 2025-02-09 19:45:45 +00:00
resource.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
result.rs feat(ecs): configurable error handling for fallible systems (#17753) 2025-02-11 18:36:08 +00:00
spawn.rs Improved Spawn APIs and Bundle Effects (#17521) 2025-02-09 23:32:56 +00:00
traversal.rs Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00