From 63a07b7ffc0d34beba6752c3c1f4f5771eb2c36b Mon Sep 17 00:00:00 2001 From: Tycho Date: Sun, 10 Aug 2014 20:47:16 +0100 Subject: [PATCH] Fixed potential crash in Player.cpp Fixes CID 71780 If ShouldBroadcastDeathMessages is false the pointer would fall through to a check agaist it being a player --- src/Entities/Player.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 8fa060a5d..8667344c7 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -906,6 +906,10 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI) } GetWorld()->BroadcastChatDeath(Printf("%s %s", GetName().c_str(), DamageText.c_str())); } + else if (a_TDI.Attacker == NULL) // && !m_World->ShouldBroadcastDeathMessages() by fallthrough + { + // no-op + } else if (a_TDI.Attacker->IsPlayer()) { cPlayer * Killer = (cPlayer *)a_TDI.Attacker;