summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_testmode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai/api/ai_testmode.cpp')
-rw-r--r--src/ai/api/ai_testmode.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ai/api/ai_testmode.cpp b/src/ai/api/ai_testmode.cpp
index 996b27874..6e2f515b4 100644
--- a/src/ai/api/ai_testmode.cpp
+++ b/src/ai/api/ai_testmode.cpp
@@ -32,9 +32,8 @@ AITestMode::AITestMode()
AITestMode::~AITestMode()
{
if (this->GetDoCommandModeInstance() != this) {
- AIInstance *instance = Company::Get(_current_company)->ai_instance;
/* Ignore this error if the AI already died. */
- if (!instance->IsDead()) {
+ if (!AIObject::GetActiveInstance()->IsDead()) {
throw AI_FatalError("AITestmode object was removed while it was not the latest AI*Mode object created.");
}
}