Wuild / GatherLite

World of Warcraft: Classic Gathering addon keeping track on where you have found stuff
MIT License
32 stars 16 forks source link

Nil value for nodes in an instance #156

Closed Byron-Miles closed 3 years ago

Byron-Miles commented 4 years ago

Describe the bug Nil value for postion variables when querying GatherLite:IsNodeInRange(myPosX, myPosY, nodePosX, nodePosY, spellType) in an instance.

To Reproduce Steps to reproduce the behavior:

  1. Go to an instance
  2. Open a chest

Potential Fix Add a check for nil values, for example:

function GatherLite:IsNodeInRange(myPosX, myPosY, nodePosX, nodePosY, spellType)
    if myPosX and myPosY and nodePosX and nodePosY then
        local distance = ((((myPosX - nodePosX) ^ 2) + ((myPosY - nodePosY) ^ 2)) ^ 0.5)
        return distance < 0.0065
    end
    return false
end
Wuild commented 3 years ago

Fixed!