Core/Misc: Fix some static analysis issues
Fix uninitialized values, most of which are false positives, always initialized before being accessed. Add some asserts and additional NULL checks as sanity checks. Use SpellMgr::EnsureSpellInfo() if the spell id is valid and always supposed to return a valid not-NULL SpellInfo* .
This commit is contained in:
1 parent
30894c2bad
commit
8c44259fae
24 files changed
+66
-44
No files matched your search
@@ -1149,7 +1149,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
|
||||
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
|
||||
}
|
||||
}
|
||||
@@ -1318,7 +1318,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
|
||||
|
||||
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
|
||||
{
|
||||
SpellInfo const* sProto = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
SpellInfo const* sProto = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
mod += CalculatePct(1.0f, sProto->Effects[1].CalcValue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user