From 5f6af8c6cbe7c5a622dd51a77e0d27db33c99118 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 5 May 2018 19:17:52 +0200 Subject: Core/Quest: Fix crash caused by disabled quests Fix crash happening when a disabled quest was added and rewarded (through a GM command). Disabled quests are not validated on startup and they can reference invalid spells. --- src/server/scripts/Commands/cs_quest.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index a97cfb19827..6d333866606 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "Chat.h" #include "DatabaseEnv.h" #include "DBCStores.h" +#include "DisableMgr.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" @@ -73,7 +74,7 @@ public: Quest const* quest = sObjectMgr->GetQuestTemplate(entry); - if (!quest) + if (!quest || DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, entry, nullptr)) { handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); handler->SetSentErrorMessage(true); @@ -185,7 +186,8 @@ public: Quest const* quest = sObjectMgr->GetQuestTemplate(entry); // If player doesn't have the quest - if (!quest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE) + if (!quest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE + || DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, entry, nullptr)) { handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); handler->SetSentErrorMessage(true); @@ -289,7 +291,8 @@ public: Quest const* quest = sObjectMgr->GetQuestTemplate(entry); // If player doesn't have the quest - if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE) + if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE + || DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, entry, nullptr)) { handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); handler->SetSentErrorMessage(true); -- cgit v1.2.3