Core/Players: Fix crash in LoadFromDB

Closes #4724
Closes #4673
This commit is contained in:
Subv2112
2012-01-08 18:37:16 +00:00
committed by Nay
parent 46332bdf15
commit 5584354444
2 changed files with 2 additions and 3 deletions
@@ -16657,6 +16657,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
_LoadInstanceTimeRestrictions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES));
_LoadBGData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBGDATA));
GetSession()->SetPlayer(this);
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !IsPositionValid())
{
@@ -776,6 +776,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
// "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
{
SetPlayer(NULL);
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
delete pCurrChar; // delete it manually
delete holder; // delete all unprocessed queries
@@ -784,9 +785,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
pCurrChar->GetMotionMaster()->Initialize();
SetPlayer(pCurrChar);
pCurrChar->SendDungeonDifficulty(false);
WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20);