diff options
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_engine.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp index 5e0ac5b4a..64c85de04 100644 --- a/src/ai/api/ai_engine.cpp +++ b/src/ai/api/ai_engine.cpp @@ -15,7 +15,8 @@ /* static */ bool AIEngine::IsValidEngine(EngineID engine_id) { - return ::IsEngineIndex(engine_id) && HasBit(::Engine::Get(engine_id)->company_avail, _current_company); + const Engine *e = ::Engine::GetIfValid(engine_id); + return e != NULL && HasBit(e->company_avail, _current_company); } /* static */ char *AIEngine::GetName(EngineID engine_id) |