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
@@ -1192,7 +1192,7 @@ class spell_gen_defend : public SpellScriptLoader
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
SpellInfo const* spell = sSpellMgr->GetSpellInfo(m_scriptSpellId);
|
||||
SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId);
|
||||
|
||||
// Defend spells cast by NPCs (add visuals)
|
||||
if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
|
||||
@@ -2178,7 +2178,7 @@ class spell_gen_mounted_charge: public SpellScriptLoader
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
SpellInfo const* spell = sSpellMgr->GetSpellInfo(m_scriptSpellId);
|
||||
SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId);
|
||||
|
||||
if (spell->HasEffect(SPELL_EFFECT_SCRIPT_EFFECT))
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_mounted_charge_SpellScript::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
|
||||
Reference in new issue
Block a user