Fix corrupt item cache crashes, bot whispers, trade crashes

This commit is contained in:
郑佩茹
2022-03-22 11:04:21 -06:00
parent b952636f0d
commit a7f412b428
21 changed files with 91 additions and 78 deletions

View File

@@ -2350,7 +2350,9 @@ void PlayerbotFactory::InitInventoryTrade()
break;
case ITEM_QUALITY_UNCOMMON:
stacks = 1;
count = urand(1, proto->GetMaxStackSize() / 2);
int maxStackSize = proto->GetMaxStackSize()/2;
uint32 max = std::max(1, maxStackSize);
count = urand(1, max);
break;
}