From 339ff320cb6de96530b578f8a2853efb1fb5e9c4 Mon Sep 17 00:00:00 2001 From: pavanvo Date: Sun, 28 Aug 2022 16:21:45 +0400 Subject: [PATCH] fix: check if unit have too match commands --- source/glest_game/types/unit_type.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index ee7b3e03..b7a63a3f 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -1286,7 +1286,9 @@ void UnitType::sortCommandTypes(CommandTypes cts){ ctCores.resize(4); for(int i = (int)ctToBasics.size(); i --> 0; ) {// we push it to basics ctBasics[basicNulls[i]] = ctToBasics[i]; - basicNulls.erase(basicNulls.begin() + i); + if(i < (int)basicNulls.size()) + basicNulls.erase(basicNulls.begin() + i); + else printf("Unit: %s have too match core commands \n", this->getName().c_str()); } }