mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Misc: Fix issues reported by static analysis
(cherry picked from commit 33dace231c)
This commit is contained in:
@@ -3018,7 +3018,7 @@ uint32 Creature::GetScriptId() const
|
||||
if (uint32 scriptId = creatureData->scriptId)
|
||||
return scriptId;
|
||||
|
||||
return sObjectMgr->GetCreatureTemplate(GetEntry())->ScriptID;
|
||||
return ASSERT_NOTNULL(sObjectMgr->GetCreatureTemplate(GetEntry()))->ScriptID;
|
||||
}
|
||||
|
||||
VendorItemData const* Creature::GetVendorItems() const
|
||||
|
||||
@@ -1050,6 +1050,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* lootedObject)
|
||||
continue;
|
||||
|
||||
item = ASSERT_NOTNULL(sObjectMgr->GetItemTemplate(i->itemid));
|
||||
ASSERT(item);
|
||||
|
||||
//roll for over-threshold item if it's one-player loot
|
||||
if (item->GetQuality() >= uint32(m_lootThreshold))
|
||||
|
||||
@@ -228,6 +228,7 @@ void GroupMgr::LoadGroups()
|
||||
Field* fields = result->Fetch();
|
||||
Group* group = GetGroupByDbStoreId(fields[0].GetUInt32());
|
||||
// group will never be NULL (we have run consistency sql's before loading)
|
||||
ASSERT(group);
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16());
|
||||
if (!mapEntry || !mapEntry->IsDungeon())
|
||||
|
||||
@@ -568,6 +568,7 @@ void PoolMgr::LoadFromDB()
|
||||
}
|
||||
|
||||
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(data->id);
|
||||
ASSERT(goinfo);
|
||||
if (goinfo->type != GAMEOBJECT_TYPE_CHEST &&
|
||||
goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE &&
|
||||
goinfo->type != GAMEOBJECT_TYPE_GATHERING_NODE &&
|
||||
|
||||
@@ -802,6 +802,7 @@ void Spell::EffectTriggerRitualOfSummoning()
|
||||
void Spell::CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedXY, float& speedZ)
|
||||
{
|
||||
Unit* unitCaster = GetUnitCasterForEffectHandlers();
|
||||
ASSERT(unitCaster);
|
||||
float runSpeed = unitCaster->IsControlledByPlayer() ? playerBaseMoveSpeed[MOVE_RUN] : baseMoveSpeed[MOVE_RUN];
|
||||
if (Creature* creature = unitCaster->ToCreature())
|
||||
runSpeed *= creature->GetCreatureTemplate()->speed_run;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user