Core/Misc: Fix some static analysis issues
Add some asserts and additional NULL checks as sanity checks.
This commit is contained in:
1 parent
ada0598bb0
commit
9e99db035f
11 files changed
+47
-23
No files matched your search
@@ -968,6 +968,7 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
|
||||
player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
|
||||
}
|
||||
|
||||
ASSERT(grp);
|
||||
grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
|
||||
uint64 gguid = grp->GetGUID();
|
||||
SetDungeon(gguid, dungeon->Entry());
|
||||
|
||||
@@ -1034,6 +1034,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
|
||||
if (!trapSpell) // checked at load already
|
||||
return;
|
||||
|
||||
ASSERT(GetOwner());
|
||||
float range = float(target->GetSpellMaxRangeForTarget(GetOwner(), trapSpell));
|
||||
|
||||
// search nearest linked GO
|
||||
|
||||
@@ -370,6 +370,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
|
||||
{
|
||||
if (flags & UPDATEFLAG_POSITION)
|
||||
{
|
||||
ASSERT(object);
|
||||
Transport* transport = object->GetTransport();
|
||||
|
||||
if (transport)
|
||||
@@ -459,6 +460,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
|
||||
// 0x4
|
||||
if (flags & UPDATEFLAG_HAS_TARGET)
|
||||
{
|
||||
ASSERT(unit);
|
||||
if (Unit* victim = unit->GetVictim())
|
||||
data->append(victim->GetPackGUID());
|
||||
else
|
||||
|
||||
@@ -4205,6 +4205,7 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId)
|
||||
break; // We can break because mount spells belong only to one skillline (at least 310 flyers do)
|
||||
|
||||
spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
ASSERT(spellInfo);
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
|
||||
spellInfo->Effects[i].CalcValue() == 310)
|
||||
@@ -15743,6 +15744,7 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg)
|
||||
|
||||
// not allow have daily quest if daily quest from exclusive group already recently completed
|
||||
Quest const* Nquest = sObjectMgr->GetQuestTemplate(exclude_Id);
|
||||
ASSERT(Nquest);
|
||||
if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false) || !SatisfyQuestSeasonal(Nquest, false))
|
||||
{
|
||||
if (msg)
|
||||
@@ -15944,6 +15946,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT(item);
|
||||
bool destroyItem = true;
|
||||
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
|
||||
if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
|
||||
@@ -21330,6 +21333,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
|
||||
if (sWorld->getBoolConfig(CONFIG_INSTANT_TAXI))
|
||||
{
|
||||
TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]);
|
||||
ASSERT(lastPathNode);
|
||||
m_taxi.ClearTaxiDestinations();
|
||||
TeleportTo(lastPathNode->map_id, lastPathNode->x, lastPathNode->y, lastPathNode->z, GetOrientation());
|
||||
return false;
|
||||
@@ -21550,6 +21554,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
|
||||
if (crItem->ExtendedCost) // case for new honor system
|
||||
{
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
|
||||
ASSERT(iece);
|
||||
if (iece->reqhonorpoints)
|
||||
ModifyHonorPoints(- int32(iece->reqhonorpoints * count));
|
||||
|
||||
|
||||
Reference in new issue
Block a user