Skip to content

Commit

Permalink
Core/Quests: Fixed crash happening when a player is quest ender
Browse files Browse the repository at this point in the history
Closes #257625
  • Loading branch information
Shauren committed Dec 24, 2020
1 parent 041ceee commit 1000f67
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/server/game/Handlers/QuestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::Quest
case TYPEID_PLAYER:
{
//For AutoSubmition was added plr case there as it almost same exclute AI script cases.
Creature* creatureQGiver = object->ToCreature();
Unit* unitQGiver = object->ToUnit();
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, quest))
{
Expand All @@ -403,7 +403,8 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::Quest
}

_player->PlayerTalkClass->ClearMenus();
creatureQGiver->GetAI()->QuestReward(_player, quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID);
if (UnitAI* qGiverAI = unitQGiver->GetAI())
qGiverAI->QuestReward(_player, quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID);
break;
}
case TYPEID_GAMEOBJECT:
Expand Down

0 comments on commit 1000f67

Please sign in to comment.