Browse Source

Add additional renderer-side safety check before calling entity renderers

Co-authored-by: djeada <[email protected]>
copilot-swe-agent[bot] 2 months ago
parent
commit
08debd24ae
1 changed files with 5 additions and 0 deletions
  1. 5 0
      render/scene_renderer.cpp

+ 5 - 0
render/scene_renderer.cpp

@@ -245,6 +245,11 @@ void Renderer::renderWorld(Engine::Core::World *world) {
 
     bool drawnByRegistry = false;
     if (unitComp && !unitComp->unitType.empty() && m_entityRegistry) {
+      if (unitComp->health <= 0 ||
+          entity->hasComponent<Engine::Core::PendingRemovalComponent>()) {
+        continue;
+      }
+
       auto fn = m_entityRegistry->get(unitComp->unitType);
       if (fn) {
         DrawContext ctx{resources(), entity, world, modelMatrix};