Various fixed

* Fixed potential invalid pointer dereferencing, fixes #1117
* Fixed ender pearls not being loaded properly
This commit is contained in:
Tiger Wang
2014-07-04 16:49:24 +01:00
parent f635066241
commit f4e3c01a71
4 changed files with 111 additions and 17 deletions
+5 -3
View File
@@ -46,10 +46,12 @@ void cThrownEnderPearlEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d
void cThrownEnderPearlEntity::TeleportCreator(const Vector3d & a_HitPos)
{
cEntity * Creator = GetCreator();
// Teleport the creator here, make them take 5 damage:
if (m_Creator != NULL)
if (Creator != NULL)
{
m_Creator->TeleportToCoords(a_HitPos.x, a_HitPos.y + 0.2, a_HitPos.z);
m_Creator->TakeDamage(dtEnderPearl, this, 5, 0);
Creator->TeleportToCoords(a_HitPos.x, a_HitPos.y + 0.2, a_HitPos.z);
Creator->TakeDamage(dtEnderPearl, this, 5, 0);
}
}