* Batch of fixes for issues found by static analysis.

This commit is contained in:
Subv
2013-05-17 21:11:18 -05:00
parent 7c18bbb95f
commit 25acef2572
10 changed files with 100 additions and 101 deletions

View File

@@ -482,7 +482,7 @@ public:
char* arg3 = strtok(NULL, " ");
bool isAccountNameGiven = true;
if (arg1 && !arg3)
if (!arg3)
{
if (!handler->getSelectedPlayer())
return false;

View File

@@ -796,7 +796,7 @@ public:
if (show == "info")
{
// Check if the user did specify a visual waypoint
if (target->GetEntry() != VISUAL_WAYPOINT)
if (target && target->GetEntry() != VISUAL_WAYPOINT)
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_SELECT);
handler->SetSentErrorMessage(true);

View File

@@ -773,7 +773,7 @@ public:
void JustSummoned(Creature* summon)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true);
if (target && summon)
if (target)
summon->Attack(target, false);
summons.Summon(summon);
}

View File

@@ -182,10 +182,8 @@ public:
}
if (!found)
{
return;
}
DoNextDialogueStep();
}
@@ -210,7 +208,7 @@ private:
void DoNextDialogueStep()
{
// Last Dialogue Entry done?
if (_currentEntry && !_currentEntry->TextEntry)
if (!_currentEntry || !_currentEntry->TextEntry)
{
_actionTimer = 0;
return;

View File

@@ -754,7 +754,7 @@ public:
void UpdateAI(uint32 diff)
{
if (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO)
if (!instance || (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO))
return;
events.Update(diff);
@@ -854,7 +854,7 @@ public:
}
}
if (_arcaneReinforcements && instance)
if (_arcaneReinforcements)
{
for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 5); rangeDisks++)
{

View File

@@ -1751,7 +1751,7 @@ public:
{
me->HandleEmoteCommand(emote);
Unit* owner = me->GetOwner();
if (emote != TEXT_EMOTE_KISS || owner || owner->GetTypeId() != TYPEID_PLAYER ||
if (emote != TEXT_EMOTE_KISS || !owner || owner->GetTypeId() != TYPEID_PLAYER ||
owner->ToPlayer()->GetTeam() != player->GetTeam())
{
return;