From 94adce2bfbd1fd2c2351f48f8fd0b9665e742bc0 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 31 Dec 2022 18:59:56 +0100 Subject: Added a check for AIState and Transform of the owner --- sim/src/TurretControl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sim/src') 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(control.owner); // no checks + if (!registry.all_of(control.owner)) + continue; + const auto& [state, transform] = registry.get(control.owner); if (!registry.valid(state.target)) continue; const auto& target = registry.get(state.target); -- cgit v1.1