aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-03-09 17:15:22 -0500
committerSubv <s.v.h21@hotmail.com>2012-03-09 17:15:22 -0500
commit7c42cd76e44d416b091aa98d9fa31f2cfd0759a8 (patch)
treecc3f36f4e94ea677cd1c10b56100c6ccfbab62e6
parent593d003b7c930ce91157bf8189286a818f9fdd09 (diff)
Core/Conditions: Prevent crash at Spell::CheckCast if Condition::Meets returned prematurely
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 65ab9444f58..a804c5b1b90 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4784,14 +4784,15 @@ SpellCastResult Spell::CheckCast(bool strict)
// TODO: using WorldSession::SendNotification is not blizzlike
if (Player* playerCaster = m_caster->ToPlayer())
{
- if (playerCaster->GetSession()
+ // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
+ if (playerCaster->GetSession() && condInfo.mLastFailedCondition
&& condInfo.mLastFailedCondition->ErrorTextId)
{
playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId);
return SPELL_FAILED_DONT_REPORT;
}
}
- if (!condInfo.mLastFailedCondition->ConditionTarget)
+ if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget)
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_FAILED_BAD_TARGETS;
}