aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-12-24 21:26:19 +0100
committerShauren <shauren.trinity@gmail.com>2020-12-24 21:26:19 +0100
commit1000f670d211f2ac5aef3351af0f08de06e13097 (patch)
treed7a7b8f4b1d1c7b1108d14073093a8dd3a34f97a
parent041ceeed1a6c2a1f4418d348631fd051056ff5c0 (diff)
Core/Quests: Fixed crash happening when a player is quest ender
Closes #257625
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 417abf4cb98..49fe2ac0345 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -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))
{
@@ -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: