mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 08:33:47 +00:00
fix(Core): Fixed a few crashes/bugs that were found via static code analysis (#2617)
This commit is contained in:
@@ -3267,7 +3267,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
|
||||
{
|
||||
if (!GetAmount())
|
||||
{
|
||||
mechanic_immunity_list = (1 << MECHANIC_CHARM) | (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
|
||||
mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
|
||||
| (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
|
||||
| (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
|
||||
| (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
|
||||
@@ -6095,7 +6095,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
|
||||
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
|
||||
{
|
||||
// xinef: leave only target depending bonuses, rest is handled in calculate amount
|
||||
if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
|
||||
if (GetBase()->GetType() == DYNOBJ_AURA_TYPE && caster)
|
||||
damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, 0.0f, GetBase()->GetStackAmount());
|
||||
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
|
||||
|
||||
|
||||
@@ -2839,7 +2839,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
}
|
||||
|
||||
// Failed Pickpocket, reveal rogue
|
||||
if (missInfo == SPELL_MISS_RESIST && m_spellInfo->HasAttribute(SPELL_ATTR0_CU_PICKPOCKET) && unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
if (missInfo == SPELL_MISS_RESIST && m_spellInfo->HasAttribute(SPELL_ATTR0_CU_PICKPOCKET) && unitTarget->GetTypeId() == TYPEID_UNIT && m_caster)
|
||||
{
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
|
||||
if (unitTarget->ToCreature()->IsAIEnabled)
|
||||
|
||||
@@ -3141,8 +3141,9 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
|
||||
|
||||
uint32 petentry = m_spellInfo->Effects[effIndex].MiscValue;
|
||||
int32 duration = m_spellInfo->GetDuration();
|
||||
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
|
||||
if (m_originalCaster)
|
||||
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
|
||||
|
||||
if (!owner)
|
||||
{
|
||||
@@ -4644,21 +4645,20 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
|
||||
default: return;
|
||||
}
|
||||
|
||||
uint64 guid = m_caster->m_ObjectSlot[slot];
|
||||
if (guid != 0)
|
||||
if (m_caster)
|
||||
{
|
||||
GameObject* gameObject = NULL;
|
||||
if (m_caster)
|
||||
gameObject = m_caster->GetMap()->GetGameObject(guid);
|
||||
|
||||
if (gameObject)
|
||||
uint64 guid = m_caster->m_ObjectSlot[slot];
|
||||
if (guid != 0)
|
||||
{
|
||||
// Recast case - null spell id to make auras not be removed on object remove from world
|
||||
if (m_spellInfo->Id == gameObject->GetSpellId())
|
||||
gameObject->SetSpellId(0);
|
||||
m_caster->RemoveGameObject(gameObject, true);
|
||||
if (GameObject* gameObject = m_caster->GetMap()->GetGameObject(guid))
|
||||
{
|
||||
// Recast case - null spell id to make auras not be removed on object remove from world
|
||||
if (m_spellInfo->Id == gameObject->GetSpellId())
|
||||
gameObject->SetSpellId(0);
|
||||
m_caster->RemoveGameObject(gameObject, true);
|
||||
}
|
||||
m_caster->m_ObjectSlot[slot] = 0;
|
||||
}
|
||||
m_caster->m_ObjectSlot[slot] = 0;
|
||||
}
|
||||
|
||||
GameObject* pGameObj = sObjectMgr->IsGameObjectStaticTransport(gameobjectId) ? new StaticTransport() : new GameObject();
|
||||
|
||||
Reference in New Issue
Block a user