diff options
author | Machiavelli <machiavelli.trinity@gmail.com> | 2013-02-14 15:01:33 +0100 |
---|---|---|
committer | Machiavelli <machiavelli.trinity@gmail.com> | 2013-02-14 15:01:33 +0100 |
commit | 8befbdcc5675d2249e4e252ba303c149df0ecad3 (patch) | |
tree | c9976c01b83efcce87b464d55768079a891ca5d8 /src | |
parent | 203cf7cbf0d860dcc12ab625226b1c7567854356 (diff) |
Core/LFG: Fix a crash
Fix a crash in case a player is recognized as in a LFG dungeon, but without a valid group
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/DungeonFinding/LFGScripts.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index a4716de9524..22b86a094dd 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -95,6 +95,20 @@ void LFGPlayerScript::OnMapChanged(Player* player) if (sLFGMgr->inLfgDungeonMap(player->GetGUID(), map->GetId(), map->GetDifficulty())) { Group* group = player->GetGroup(); + // This function is also called when players log in + // if for some reason the LFG system recognises the player as being in a LFG dungeon, + // but the player was loaded without a valid group, we'll teleport to homebind to prevent + // crashes or other undefined behaviour + if (!group) + { + sLFGMgr->LeaveLfg(player->GetGUID()); + player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); + player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, 0.0f); + sLog->outError(LOG_FILTER_LFG, "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! " + "Teleporting to homebind.", player->GetName().c_str(), player->GetGUIDLow()); + return; + } + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) player->GetSession()->SendNameQueryOpcode(member->GetGUID()); |