fix ammo cache, enchant coredump

This commit is contained in:
Yunfan Li
2023-08-08 18:24:59 +08:00
parent 863248b3f3
commit 5feb47d5ed
2 changed files with 21 additions and 10 deletions

View File

@@ -4013,7 +4013,7 @@ void PlayerbotAI::ImbueItem(Item* item, uint32 targetFlag, ObjectGuid targetGUID
void PlayerbotAI::EnchantItemT(uint32 spellid, uint8 slot)
{
Item* pItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (!pItem || !pItem->IsInWorld())
if (!pItem || !pItem->IsInWorld() || !pItem->GetOwner() || !pItem->GetOwner()->IsInWorld() || !pItem->GetOwner()->GetSession())
return;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);