Fix initself crash

This commit is contained in:
Yunfan Li
2024-09-05 15:57:32 +08:00
parent 369f3373ed
commit 73f699fe89
2 changed files with 7 additions and 5 deletions

View File

@@ -2060,7 +2060,8 @@ bool PlayerbotFactory::CanEquipUnseenItem(uint8 slot, uint16& dest, uint32 item)
if (Item* pItem = Item::CreateItem(item, 1, bot, false, 0, true))
{
InventoryResult result = botAI->CanEquipItem(slot, dest, pItem, true, true);
InventoryResult result = botAI ? botAI->CanEquipItem(slot, dest, pItem, true, true)
: bot->CanEquipItem(slot, dest, pItem, true, true);
pItem->RemoveFromUpdateQueueOf(bot);
delete pItem;
return result == EQUIP_ERR_OK;
@@ -2382,10 +2383,10 @@ void PlayerbotFactory::InitAvailableSpells()
{
bot->learnSpell(tSpell->learnedSpell[0], false);
}
else
{
botAI->CastSpell(tSpell->spell, bot);
}
// else
// {
// botAI->CastSpell(tSpell->spell, bot);
// }
}
// LOG_INFO("playerbots", "C: {}, ok: {}", ++learnedCounter, oktest);
// if (++learnedCounter > 20)