Skip to content

Commit

Permalink
Fixed invalid entity lookup for physics body.
Browse files Browse the repository at this point in the history
  • Loading branch information
afritz1 committed Jan 12, 2025
1 parent 9d944a5 commit a8f4e99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions OpenTESArena/src/Entities/EntityChunkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,10 @@ EntityInstanceID EntityChunkManager::getEntityFromPhysicsBodyID(JPH::BodyID body
// @todo: probably want a smarter lookup than this
for (int i = 0; i < this->entities.getTotalCount(); i++)
{
const EntityInstance &entityInst = this->entities.get(i);
if (entityInst.physicsBodyID == bodyID)
const EntityInstance *entityInst = this->entities.tryGet(i);
if (entityInst != nullptr && entityInst->physicsBodyID == bodyID)
{
return entityInst.instanceID;
return entityInst->instanceID;
}
}

Expand Down

0 comments on commit a8f4e99

Please sign in to comment.