diff options
| author | jackpoz <giacomopoz@gmail.com> | 2015-12-06 21:02:52 +0100 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2015-12-06 21:37:58 +0100 |
| commit | f1f4005ad8a17ea5fdd2b66f8ed3d0bd7c4c1efb (patch) | |
| tree | 3e1c1779951d51f366c27e0ae0aeabd618c6380e /src/server/game/Entities/Unit | |
| parent | e60bbaa7d39c690a759c96ee83ab8311e700a8e1 (diff) | |
Core/Quest: Fix issues reported by static analysis
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 7 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4fedf80e968..277ead92df7 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8291,6 +8291,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 15337: // Improved Spirit Tap (Rank 1) case 15338: // Improved Spirit Tap (Rank 2) { + ASSERT(procSpell); if (procSpell->SpellFamilyFlags[0] & 0x800000) if ((procSpell->Id != 58381) || !roll_chance_i(50)) return false; @@ -8552,7 +8553,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // try detect target manually if not set if (target == NULL) - target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry && triggerEntry->IsPositive() ? this : victim; + target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim; if (basepoints0) CastCustomSpell(target, trigger_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura); @@ -9648,7 +9649,7 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo) && _IsValidAttackTarget(magnet, spellInfo)) { /// @todo handle this charge drop by proc in cast phase on explicit target - if (victim && spellInfo->Speed > 0.0f) + if (spellInfo->Speed > 0.0f) { // Set up missile speed based delay uint32 delay = uint32(std::floor(std::max<float>(victim->GetDistance(this), 5.0f) / spellInfo->Speed * 1000.0f)); @@ -16041,7 +16042,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) // Vehicle should not attack its passenger after he exists the seat if (type != CHARM_TYPE_VEHICLE) - LastCharmerGUID = charmer->GetGUID(); + LastCharmerGUID = ASSERT_NOTNULL(charmer)->GetGUID(); } // If charmer still exists diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 72f3a6682fa..f8e45c073f2 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -898,6 +898,12 @@ public: uint32 GetHitMask() const { return _hitMask; } SpellInfo const* GetSpellInfo() const { return NULL; } + SpellInfo const* EnsureSpellInfo() const + { + SpellInfo const* spellInfo = GetSpellInfo(); + ASSERT(spellInfo); + return spellInfo; + } SpellSchoolMask GetSchoolMask() const { return SPELL_SCHOOL_MASK_NONE; } DamageInfo* GetDamageInfo() const { return _damageInfo; } |
