Browse Source

Fix crash on giving WoG experience - quantity 0 unit on army transfer

Dydzio 1 year ago
parent
commit
bcda68abef
1 changed files with 3 additions and 1 deletions
  1. 3 1
      server/CGameHandler.cpp

+ 3 - 1
server/CGameHandler.cpp

@@ -1973,7 +1973,9 @@ bool CGameHandler::bulkMoveArmy(ObjectInstanceID srcArmy, ObjectInstanceID destA
 		{
 			const bool needsLastStack = armySrc->needsLastStack();
 			const auto quantity = setSrc.getStackCount(srcSlot) - (needsLastStack ? 1 : 0);
-			moves.insert(std::make_pair(srcSlot, std::make_pair(slotToMove, quantity)));
+
+			if(quantity > 0) //0 may happen when we need last creature and we have exactly 1 amount of that creature - amount of "rest we can transfer" becomes 0
+				moves.insert(std::make_pair(srcSlot, std::make_pair(slotToMove, quantity)));
 		}
 	}
 	BulkRebalanceStacks bulkRS;