Core/Loot: Fixed crash happening when looting items into new stack or items with random properties

Closes #17700
This commit is contained in:
Shauren
2016-07-31 17:26:46 +02:00
parent c3a7a9e672
commit 53aecd6f09
2 changed files with 3 additions and 5 deletions
+2 -4
View File
@@ -778,8 +778,7 @@ void Item::SetItemRandomProperties(int32 randomPropId)
if (randomPropId > 0)
{
ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(-randomPropId);
if (sItemRandomPropertiesStore.LookupEntry(randomPropId))
if (ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId))
{
if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != randomPropId)
{
@@ -792,8 +791,7 @@ void Item::SetItemRandomProperties(int32 randomPropId)
}
else
{
ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId);
if (item_rand)
if (ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId))
{
if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != randomPropId || !GetItemSuffixFactor())
{
+1 -1
View File
@@ -11544,7 +11544,7 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update)
lastItem = _StoreItem(pos, pItem, count, true, update);
}
AutoUnequipChildItem(pItem);
AutoUnequipChildItem(lastItem);
return lastItem;
}