mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 07:22:02 -04:00
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:
@@ -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