Skip to content

Commit

Permalink
Remove redundant bounds check in Entities::get (#8108)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhostet authored Mar 16, 2023
1 parent 4a62afb commit f3d6c2d
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 f3d6c2d

Please sign in to comment.