diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 4af8fdd1..e792451b 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -175,8 +175,11 @@ Entity::~Entity() { CancelAllTimers(); CancelCallbackTimers(); - for (const auto& component : m_Components | std::views::values) { - if (component) delete component; + for (auto& component : m_Components | std::views::values) { + if (component) { + delete component; + component = nullptr; + } } for (auto* const child : m_ChildEntities) {