Skip to content

Commit

Permalink
harden conditions against garbage in custom state
Browse files Browse the repository at this point in the history
It's not impossible for a user to declare that a TSU variable is of type string,
but then actually populate it with something else entirely. Unfortunately,
"TSU variables are trustworthy" is an invariant conditions relies on, so e.g.
a condition to check if a string variable contains a substring would fail
if a joker populated the state variable with a non-string value.

Since Conditions are evaluated on a critical path to opening options, we need to trap any errors
from this kind of shenanigans to allow the user to back out of their foolishness. Simply wrapping
RunConditions in xpcall will possibly lead to half finished property applications, but that is
much preferable to Options bricking up.
  • Loading branch information
emptyrivers committed Dec 11, 2024
1 parent 0ff1c4c commit f90441c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion WeakAuras/Conditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ end
function Private.RunConditions(region, uid, hideRegion)
if (checkConditions[uid]) then
Private.ActivateAuraEnvironmentForRegion(region)
checkConditions[uid](region, hideRegion);
xpcall(checkConditions[uid], Private.GetErrorHandlerUid(uid, L["Execute Conditions"]), region, hideRegion);
Private.ActivateAuraEnvironment()
end
end
Expand Down

0 comments on commit f90441c

Please sign in to comment.