aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2021-06-20 13:11:53 +0200
committerShauren <shauren.trinity@gmail.com>2022-03-11 11:48:18 +0100
commitd0fe16b78743bace4e620089787dfd3919a31a68 (patch)
treefbdf93418f3eaac9b642f4ec4ef5e751a0097975 /src/server/scripts
parent7d01ad8b8f7d20769058c642e690847aa51196c6 (diff)
Core/Misc: Fix issues reported by static analysis
(cherry picked from commit 33dace231c5a169375523ffa89a2cc3fa48737bd)
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp8
-rw-r--r--src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp4
-rw-r--r--src/server/scripts/World/achievement_scripts.cpp2
4 files changed, 6 insertions, 10 deletions
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index bfd84278a14..97ec8648d2e 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -206,9 +206,7 @@ public:
sObjectMgr->AddVendorItem(vendor_entry, vItem);
- ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
-
- handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, itemTemplate->GetDefaultLocaleName(), maxcount, incrtime, extendedcost);
+ handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, item->GetDefaultLocaleName(), maxcount, incrtime, extendedcost);
return true;
}
@@ -360,9 +358,7 @@ public:
return false;
}
- ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
-
- handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, itemTemplate->GetDefaultLocaleName());
+ handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, item->GetDefaultLocaleName());
return true;
}
diff --git a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
index 7a9a7ce3594..c3263533db1 100644
--- a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
+++ b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
@@ -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()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms));
+ GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), ASSERT_NOTNULL(GetHitPlayer())->GetGUID()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms));
}
void Register() override
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
index 5c39a3c9e04..f245bd6e873 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
@@ -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()
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 30364ac5fe6..46e221e5753 100644
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -144,7 +144,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: