Core/Misc: Fix static analysis issues

Fix static analysis issues reported by 3rd party tools

(cherry picked from commit 24e82fe83d)
This commit is contained in:
jackpoz
2017-12-08 17:33:10 +01:00
committed by funjoker
parent 668a3ad643
commit a01d397c3d
12 changed files with 24 additions and 24 deletions

View File

@@ -321,7 +321,7 @@ public:
if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON)))
{
if (fetchVesp && fetchVesp->IsAlive() && !fetchVesp->GetVictim())
if (fetchVesp->IsAlive() && !fetchVesp->GetVictim())
{
_canUseWill = true;
if (!fetchVesp->IsInCombat())

View File

@@ -227,7 +227,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true))
{
if (target && target->IsAlive())
if (target->IsAlive())
{
DoCast(target, SPELL_HAMMER_JUSTICE);
DoCast(target, SPELL_HAMMER_RIGHTEOUS);
@@ -353,7 +353,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, SPELL_HOLY_FIRE);
}
if (me->HasAura(SPELL_SHIELD))
@@ -366,7 +366,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, SPELL_SMITE);
}
if (me->HasAura(SPELL_SHIELD))
@@ -459,7 +459,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, SPELL_OLD_WOUNDS);
}
uiOldWoundsTimer = 12000;
@@ -475,7 +475,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, SPELL_SHADOWS_PAST);
}
uiShadowPastTimer = 5000;

View File

@@ -197,7 +197,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, SPELL_DEATH_RESPITE);
}
uiDeathRespiteTimer = urand(15000, 16000);
@@ -225,7 +225,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, SPELL_DESECRATION);
}
uiDesecration = urand(15000, 16000);
@@ -252,7 +252,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, SPELL_MARKED_DEATH);
}
uiMarkedDeathTimer = urand(5000, 7000);
@@ -333,7 +333,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
{
if (target && target->IsAlive())
if (target->IsAlive())
DoCast(target, (SPELL_LEAP));
}
uiAttackTimer = 3500;

View File

@@ -1004,7 +1004,7 @@ class npc_ball_of_flame : public CreatureScript
{
// need to clear states now because this call is before AuraEffect is fully removed
me->ClearUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED);
if (target && me->Attack(target, true))
if (me->Attack(target, true))
me->GetMotionMaster()->MoveChase(target, 1.0f);
}
}

View File

@@ -924,7 +924,7 @@ class spell_q9874_liquid_fire : public SpellScriptLoader
{
Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature())
if (target && !target->HasAura(SPELL_FLAMES))
if (!target->HasAura(SPELL_FLAMES))
{
caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT);
target->CastSpell(target, SPELL_FLAMES, true);