mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Merge pull request #2636 from LihO/master
Core/Auras: Check amount of total ticks to avoid division by zero (and crash) in Unit::GetRemainingPeriodicAmount.
This commit is contained in:
@@ -17385,7 +17385,7 @@ uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType
|
||||
AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType);
|
||||
for (AuraEffectList::const_iterator i = periodicAuras.begin(); i != periodicAuras.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetCasterGUID() != caster || (*i)->GetId() != spellId || (*i)->GetEffIndex() != effectIndex)
|
||||
if ((*i)->GetCasterGUID() != caster || (*i)->GetId() != spellId || (*i)->GetEffIndex() != effectIndex || (*i)->GetTotalTicks() == 0)
|
||||
continue;
|
||||
amount += uint32(((*i)->GetAmount() * std::max<int32>((*i)->GetTotalTicks() - int32((*i)->GetTickNumber()), 0)) / (*i)->GetTotalTicks());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user