vmangos / core

Progressive Vanilla Core aimed at all versions from 1.2 to 1.12
GNU General Public License v2.0
646 stars 529 forks source link

🐛 [Bug] Swiftmend crash fix #2695

Open Wall-core opened 1 week ago

Wall-core commented 1 week ago

Swiftmend uses a jank blizzlike structure and has its own special function handling it. this function can crash if you somehow hit a race condition on the dispel mask. It can be fixed by checking the iterator is valid before checking spellproto. In Unit.cpp:

bool Unit::HasAuraFamily(AuraType type, SpellFamily family, uint64 familyFlag) const
{
    AuraList const& auras = GetAurasByType(type);
    for (const auto& i : auras)
        if **(i && i->GetSpellProto() &&** i->GetSpellProto()->IsFitToFamily(family, familyFlag))
            return true;

    return false;
}