summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/src/TurretControl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/sim/src/TurretControl.cpp b/sim/src/TurretControl.cpp
index 19dbe21..57fae4a 100644
--- a/sim/src/TurretControl.cpp
+++ b/sim/src/TurretControl.cpp
@@ -26,7 +26,9 @@ TurretControl::update(entt::registry& registry, entt::dispatcher& dispatcher, co
registry.destroy(entity);
continue;
}
- const auto& [state, transform] = registry.get<AIState, Transform>(control.owner); // no checks
+ if (!registry.all_of<AIState, Transform>(control.owner))
+ continue;
+ const auto& [state, transform] = registry.get<AIState, Transform>(control.owner);
if (!registry.valid(state.target))
continue;
const auto& target = registry.get<Transform>(state.target);