diff --git a/src/game/Game/LifebuoySystem.cpp b/src/game/Game/LifebuoySystem.cpp index 86ac22b..3192464 100644 --- a/src/game/Game/LifebuoySystem.cpp +++ b/src/game/Game/LifebuoySystem.cpp @@ -49,6 +49,11 @@ void dd::Systems::LifebuoySystem::Update(double dt) auto transformComponent = m_World->GetComponent(it->Entity); auto lifebuoyComponent = m_World->GetComponent(it->Entity); + if (!m_World->ValidEntity(it->Entity)){ + m_Lifebuoys.erase(it++); + } + + if (transformComponent->Position.y < m_DownEdge) { m_World->RemoveEntity(it->Entity); m_Lifebuoys.erase(it++);