[11445] Correct a possible crash, if caster of aura has disconnected after aura applied

A small code adjustment in addition, no need for caster at aura remove.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-05-08 19:47:59 +02:00
parent b62c7f17f0
commit 6d28c7dfd0
3 changed files with 8 additions and 6 deletions

View file

@ -8040,11 +8040,11 @@ void Aura::HandleAuraMirrorImage(bool apply, bool Real)
// Target of aura should always be creature (ref Spell::CheckCast)
Creature* pCreature = (Creature*)GetTarget();
if (apply)
{
// Caster can be player or creature, the unit who pCreature will become an clone of.
Unit* caster = GetCaster();
if (apply)
{
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 0, caster->getRace());
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 1, caster->getClass());
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 2, caster->getGender());

View file

@ -638,7 +638,7 @@ void WorldSession::HandleGetMirrorimageData(WorldPacket& recv_data)
data << (uint8)pCreature->getGender();
data << (uint8)pCreature->getClass();
if (pCaster->GetTypeId() == TYPEID_PLAYER)
if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER)
{
Player* pPlayer = (Player*)pCaster;
@ -677,7 +677,9 @@ void WorldSession::HandleGetMirrorimageData(WorldPacket& recv_data)
}
else
{
// No data when cloner is not player, data is taken from CreatureDisplayInfoExtraEntry by model already
// pCaster may have been NULL (usually not expected, but may happen at disconnect, etc)
// OR
// pCaster is not player, data is taken from CreatureDisplayInfoExtraEntry by model already
data << (uint8)0;
data << (uint8)0;
data << (uint8)0;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11444"
#define REVISION_NR "11445"
#endif // __REVISION_NR_H__