summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/saveload/ai_sl.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/saveload/ai_sl.cpp b/src/saveload/ai_sl.cpp
index fedd3699a..c3a95f89b 100644
--- a/src/saveload/ai_sl.cpp
+++ b/src/saveload/ai_sl.cpp
@@ -66,6 +66,8 @@ static void Load_AIPL()
CompanyID index;
while ((index = (CompanyID)SlIterateArray()) != (CompanyID)-1) {
+ if (index >= MAX_COMPANIES) SlErrorCorrupt("Too many AI configs");
+
_ai_saveload_version = -1;
SlObject(NULL, _ai_company);