Core/Misc: Fix issues reported by static analysis

This commit is contained in:
jackpoz
2021-06-20 13:11:53 +02:00
parent 5446209b89
commit 33dace231c
13 changed files with 17 additions and 14 deletions

View File

@@ -197,9 +197,7 @@ public:
sObjectMgr->AddVendorItem(vendor_entry, itemId, maxcount, incrtime, extendedcost);
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, itemTemplate->Name1.c_str(), maxcount, incrtime, extendedcost);
handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, item->Name1.c_str(), maxcount, incrtime, extendedcost);
return true;
}
@@ -351,9 +349,7 @@ public:
return false;
}
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, itemTemplate->Name1.c_str());
handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, item->Name1.c_str());
return true;
}

View File

@@ -204,7 +204,7 @@ class spell_ioc_launch : public SpellScript
if (!GetCaster()->ToCreature() || !GetExplTargetDest())
return;
GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), GetHitPlayer()->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms));
GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), ASSERT_NOTNULL(GetHitPlayer())->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms));
}
void Register() override

View File

@@ -113,7 +113,7 @@ private:
struct npc_underbog_mushroom : public ScriptedAI
{
npc_underbog_mushroom(Creature* creature) : ScriptedAI(creature) { }
npc_underbog_mushroom(Creature* creature) : ScriptedAI(creature), _counter(0) { }
void InitializeAI() override
{
@@ -154,7 +154,7 @@ struct npc_underbog_mushroom : public ScriptedAI
private:
TaskScheduler _scheduler;
uint32 _counter = 0;
uint32 _counter;
};
void AddSC_boss_hungarfen()

View File

@@ -2019,7 +2019,7 @@ class spell_dk_raise_dead : public SpellScriptLoader
SpellCastResult CheckReagents()
{
/// @workaround: there is no access to castresult of other spells, check it manually
SpellInfo const* reagentSpell = sSpellMgr->GetSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT);
SpellInfo const* reagentSpell = sSpellMgr->AssertSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT);
Player* player = GetCaster()->ToPlayer();
if (!player->CanNoReagentCast(reagentSpell))
{

View File

@@ -143,7 +143,7 @@ class achievement_arena_kills : public AchievementCriteriaScript
if (!source->InArena())
return false;
return source->GetBattleground()->GetArenaType() == _arenaType;
return ASSERT_NOTNULL(source->GetBattleground())->GetArenaType() == _arenaType;
}
private: