Skip to content

Commit

Permalink
Remove redundant bounds check in Entities::get (bevyengine#8108)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhostet authored and Shfty committed Mar 19, 2023
1 parent c1ceefd commit a4f762e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/bevy_ecs/src/entity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,7 @@ impl Entities {
/// Returns the location of an [`Entity`].
/// Note: for pending entities, returns `Some(EntityLocation::INVALID)`.
pub fn get(&self, entity: Entity) -> Option<EntityLocation> {
if (entity.index as usize) < self.meta.len() {
let meta = &self.meta[entity.index as usize];
if let Some(meta) = self.meta.get(entity.index as usize) {
if meta.generation != entity.generation
|| meta.location.archetype_id == ArchetypeId::INVALID
{
Expand Down

0 comments on commit a4f762e

Please sign in to comment.