Fix seg fault on bots rolling

Using group->GetRolls() brings back a vector that gives a segmentation fault on one of the iterations when iterated.
This commit is contained in:
Vale the Violet Mote 2019-06-01 11:48:12 -04:00 committed by GitHub
parent a521df114e
commit 528179cb02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,27 +23,20 @@ bool LootRollAction::Execute(Event event)
return false;
RollVote vote = ROLL_PASS;
for (vector<Roll*>::iterator i = group->GetRolls().begin(); i != group->GetRolls().end(); ++i)
{
if ((*i)->isValid() && (*i)->lootedTargetGUID == guid && (*i)->itemSlot == slot)
{
uint32 itemId = (*i)->itemid;
ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(itemId);
if (!proto)
continue;
switch (proto->Class)
{
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_ARMOR:
if (QueryItemUsage(proto))
vote = ROLL_NEED;
break;
default:
if (IsLootAllowed(itemId))
vote = ROLL_NEED;
break;
}
ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(guid.GetEntry());
if(proto)
{
switch (proto->Class)
{
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_ARMOR:
if (QueryItemUsage(proto))
vote = ROLL_NEED;
break;
default:
if (IsLootAllowed(guid.GetEntry()))
vote = ROLL_NEED;
break;
}
}