From d6edeb998b37d2be2c9baafa09dc13f70bb0ce9c Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 15 Jan 2024 14:01:12 -0800 Subject: [PATCH] Fix rare panic when swapping items --- sim/core/attack.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sim/core/attack.go b/sim/core/attack.go index 4827d143eb..97fe1dd898 100644 --- a/sim/core/attack.go +++ b/sim/core/attack.go @@ -266,8 +266,11 @@ func (wa *WeaponAttack) swing(sim *Simulation) time.Duration { // Need to check APL here to allow last-moment HS queue casts. wa.unit.Rotation.DoNextAction(sim) - // Allow MH swing to be overridden for abilities like Heroic Strike. - attackSpell = wa.replaceSwing(sim, attackSpell) + // Need to check this again in case the DoNextAction call swapped items. + if wa.replaceSwing != nil { + // Allow MH swing to be overridden for abilities like Heroic Strike. + attackSpell = wa.replaceSwing(sim, attackSpell) + } } // Update swing timer BEFORE the cast, so that APL checks for TimeToNextAuto behave correctly