2
0
Эх сурвалжийг харах

Fixed possible overflow with weight calculaton in tradelist.

_DS_ 15 жил өмнө
parent
commit
217005510a

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/TradeList.java

@@ -636,7 +636,7 @@ public class TradeList
 	 */
 	public int calcItemsWeight()
 	{
-		int weight = 0;
+		long weight = 0;
 
 		for (TradeItem item : _items)
 		{
@@ -648,7 +648,7 @@ public class TradeList
 			weight += item.getCount() * template.getWeight();
 		}
 
-		return weight;
+		return Math.min((int)weight, Integer.MAX_VALUE);
 	}
 
 	/**