The dead and nodead conditions in Conditionals.lua throw an error when conditionals.target is nil.
Error message:
ERROR: Interface\AddOns\Roid-Macros\Conditionals.lua:833: Usage: UnitIsDeadOrGhost("unit")
Cause
When using dead or nodead conditions without an explicit @target specifier, and no target is selected in-game (or autoSelfCast CVar is disabled), conditionals.target remains nil. The UnitIsDeadOrGhost() API call then fails because it receives nil instead of a valid unit ID.
Fix
Add a nil check to both functions that returns false if there's no target to check.
diff --git i/Conditionals.lua w/Conditionals.lua
index 85e0300..ae8bb1d 100644
--- i/Conditionals.lua
+++ w/Conditionals.lua
@@ -826,10 +826,12 @@ Roids.Keywords = {
end,
dead = function(conditionals)
+ if not conditionals.target then return false end
return UnitIsDeadOrGhost(conditionals.target);
end,
nodead = function(conditionals)
+ if not conditionals.target then return false end
return not UnitIsDeadOrGhost(conditionals.target);
end,
Other similar functions like ValidatePower, ValidateRawPower, and ValidateHp already have this nil check pattern:
if not unit then return false end
The
deadandnodeadconditions inConditionals.luathrow an error whenconditionals.targetisnil.Error message:
ERROR: Interface\AddOns\Roid-Macros\Conditionals.lua:833: Usage: UnitIsDeadOrGhost("unit")
Cause
When using
deadornodeadconditions without an explicit@targetspecifier, and no target is selected in-game (orautoSelfCastCVar is disabled),conditionals.targetremainsnil. TheUnitIsDeadOrGhost()API call then fails because it receivesnilinstead of a valid unit ID.Fix
Add a nil check to both functions that returns
falseif there's no target to check.