Dungeon Finder: Fix a possible crash in UpdateProposal

--HG--
branch : trunk
This commit is contained in:
Spp
2010-08-18 22:32:11 +02:00
parent d47b9851cd
commit eebb36ba58
+10 -6
View File
@@ -1074,9 +1074,10 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint32 lowGuid, uint8 accept)
LfgProposal *pProposal = itProposal->second; LfgProposal *pProposal = itProposal->second;
// Check if proposal have the current player // Check if proposal have the current player
LfgProposalPlayer *ppPlayer = pProposal->players[lowGuid]; LfgProposalPlayerMap::iterator itProposalPlayer = pProposal->players.find(lowGuid);
if (!ppPlayer) if (itProposalPlayer == pProposal->players.end())
return; return;
LfgProposalPlayer *ppPlayer = itProposalPlayer->second;
ppPlayer->accept = accept; ppPlayer->accept = accept;
if (!accept) if (!accept)
@@ -1094,10 +1095,13 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint32 lowGuid, uint8 accept)
{ {
plr = sObjectMgr.GetPlayer(itPlayers->first); plr = sObjectMgr.GetPlayer(itPlayers->first);
if (plr && itPlayers->first == pProposal->leaderLowGuid) if (plr)
players.push_front(plr); {
else if (itPlayers->first == pProposal->leaderLowGuid)
players.push_back(plr); players.push_front(plr);
else
players.push_back(plr);
}
if (itPlayers->second->accept < 1) // No answer (-1) or not accepted (0) if (itPlayers->second->accept < 1) // No answer (-1) or not accepted (0)
allAnswered = false; allAnswered = false;