ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Bug Reports (https://www.esoui.com/forums/forumdisplay.php?f=187)
-   -   [open] ZO_StateEngine bug (https://www.esoui.com/forums/showthread.php?t=9269)

Katorrei 07/12/20 01:52 PM

[open] ZO_StateEngine bug
 
You will see that the passed arg is NOT used (I commented out the original code). optionalEdgeTemplate (Edge, Transition, whatever you wanna call it.) is passed from other functions as such... But used on this line (466) as optionalStateTemplate, which defaults to a global.

If overridden the function in my addon, but another work around would be to use optionalStateTemplate as a global before calling AddEdge.

I don't see it being used anywhere in the default UI, but I think we can all agree we don't like to see a bug in functions directly attached to the Crown store!

Code:

function ZO_StateMachine_Base:AddEdge(edgeName, fromState, toState, optionalEdgeTemplate, ...)
    if type(fromState) == "string" then
        fromState = self:GetStateByName(fromState)
    end
    if type(toState) == "string" then
        toState = self:GetStateByName(toState)
    end
    -- Original ZOS code:
    -- local template = optionalStateTemplate or ZO_StateMachine_Edge
    --
    -- Suggested Change:
    local template = optionalEdgeTemplate or ZO_StateMachine_Edge
    --
    -- Other Workaround:
    -- Treat optionalStateTemplate as a global before passing to AddEdge
   
    local edge = template:New(fromState, toState, ...)
    self.edges[edgeName] = edge
    return edge
end


ZOS_DanBatson 07/13/20 11:53 AM

Thank you for the heads up, will correct this.


All times are GMT -6. The time now is 07:15 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI