Fix crash in kill protection

This commit is contained in:
def 2014-08-25 11:35:55 +02:00
parent 4311df0c62
commit 05dd0b4af7

View file

@ -1480,9 +1480,13 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
if(pPlayer->m_Paused) if(pPlayer->m_Paused)
return; return;
CCharacter* pChr = pPlayer->GetCharacter();
if(!pChr)
return;
//Kill Protection //Kill Protection
int CurrTime = (Server()->Tick() - pPlayer->GetCharacter()->m_StartTime) / Server()->TickSpeed(); int CurrTime = (Server()->Tick() - pChr->m_StartTime) / Server()->TickSpeed();
if(g_Config.m_SvKillProtection != 0 && CurrTime >= (60 * g_Config.m_SvKillProtection) && pPlayer->GetCharacter()->m_DDRaceState == DDRACE_STARTED) if(g_Config.m_SvKillProtection != 0 && CurrTime >= (60 * g_Config.m_SvKillProtection) && pChr->m_DDRaceState == DDRACE_STARTED)
{ {
SendChatTarget(ClientID, "Kill Protection enabled. If you really want to kill, write /kill"); SendChatTarget(ClientID, "Kill Protection enabled. If you really want to kill, write /kill");
return; return;