From 2ad935481ec6903b4d981e4eeeefc059a4bec462 Mon Sep 17 00:00:00 2001 From: mathusummut Date: Thu, 27 Sep 2018 00:13:16 +0200 Subject: [PATCH] Fixed potential OOS --- source/glest_game/game/commander.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index 2eecbff71..c77f6baed 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -427,8 +427,10 @@ namespace const Unit * targetUnit, bool tryQueue, int unitCommandGroupId, bool isMove) const { + std::pair < CommandResult, string > result(crFailUndefined, ""); + if (this->pauseNetworkCommands == true) { - return std::pair < CommandResult, string >(crFailUndefined, ""); + return result; } if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem). @@ -438,8 +440,6 @@ namespace extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__); - std::pair < CommandResult, string > result(crFailUndefined, ""); - if (selection->isEmpty() == false) { Vec2i refPos, @@ -684,7 +684,7 @@ namespace } /*throw megaglest_runtime_error(szBuf);*/ - return result; + return std::pair(crFailUndefined, ""); } }