Skip to content

Commit

Permalink
fix: entt crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamashi committed Apr 27, 2022
1 parent 8604edf commit cc4291c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Code/client/Services/Generic/CharacterService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,16 @@ void CharacterService::OnActorRemoved(const ActorRemovedEvent& acEvent) noexcept
return;
}

auto& formIdComponent = m_world.get<FormIdComponent>(*entityIt);
const auto cId = *entityIt;

auto& formIdComponent = view.get<FormIdComponent>(cId);
CancelServerAssignment(*entityIt, formIdComponent.Id);

if (m_world.all_of<FormIdComponent>(*entityIt))
m_world.remove<FormIdComponent>(*entityIt);
if (m_world.all_of<FormIdComponent>(cId))
m_world.remove<FormIdComponent>(cId);

if (m_world.orphan(*entityIt))
m_world.destroy(*entityIt);
if (m_world.orphan(cId))
m_world.destroy(cId);
}

void CharacterService::OnUpdate(const UpdateEvent& acUpdateEvent) noexcept
Expand Down

0 comments on commit cc4291c

Please sign in to comment.