From 5ebadee1783da2fd56ed41192b03c9fa6016b9fd Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 1 Jan 2024 20:57:38 -0800 Subject: [PATCH] Fix crash caused by #4118 --- sim/core/apl.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sim/core/apl.go b/sim/core/apl.go index 542c283cf7..8ee0253195 100644 --- a/sim/core/apl.go +++ b/sim/core/apl.go @@ -133,10 +133,13 @@ func (unit *Unit) newAPLRotation(config *proto.APLRotation) *APLRotation { // Remove MCDs that are referenced by APL actions, so that the Autocast Other Cooldowns // action does not include them. - character := unit.Env.Raid.GetPlayerFromUnit(unit).GetCharacter() - for _, action := range rotation.allAPLActions() { - if castSpellAction, ok := action.impl.(*APLActionCastSpell); ok { - character.removeInitialMajorCooldown(castSpellAction.spell.ActionID) + agent := unit.Env.GetAgentFromUnit(unit) + if agent != nil { + character := agent.GetCharacter() + for _, action := range rotation.allAPLActions() { + if castSpellAction, ok := action.impl.(*APLActionCastSpell); ok { + character.removeInitialMajorCooldown(castSpellAction.spell.ActionID) + } } }