# HG changeset patch # User Vynn # Date 1487566949 18000 # Node ID 63bf46cfbd3ccbedb81d22d55a063010df260bd5 # Parent 7c8e685be40d96539434567c15bdeae16ae71a81 Added some validation behavior to nip a few annoying errors in the bud. diff -r 7c8e685be40d -r 63bf46cfbd3c WhistleMaster.lua --- a/WhistleMaster.lua Mon Dec 26 11:21:55 2016 -0500 +++ b/WhistleMaster.lua Mon Feb 20 00:02:29 2017 -0500 @@ -16,9 +16,13 @@ local function GetDistance(nX, nY) local pX, pY = GetPlayerMapPosition("player") - - local dX = pX - nX - local dY = pY - nY + local dX, dY + if pX and pY then + dX = pX - nX + dY = pY - nY + else + return nil + end return math.sqrt( ( dX^2 ) + ( dY^2 ) ) end @@ -45,10 +49,14 @@ function UpdateWhistleMaster() if GetCurrentMapContinent() == 8 and WM_validIDs[ select(1, GetCurrentMapAreaID() ) ] and GetMapNameByID(GetCurrentMapAreaID()) == GetZoneText() and not GetNumDungeonMapLevels() then WM_ClosestNode = GetNode() - WhistleLoc:SetPoint("CENTER", "WorldMapFramePOI" .. WM_ClosestNode.index, 0, 0) - WhistleLoc:Show() - WhistlePing.Ping:Play() - return true + if _G[("WorldMapFramePOI" .. WM_ClosestNode.index)] then + WhistleLoc:SetPoint("CENTER", "WorldMapFramePOI" .. WM_ClosestNode.index, 0, 0) + WhistleLoc:Show() + WhistlePing.Ping:Play() + return true + else + return false + end else WhistleLoc:Hide() WhistlePing.Ping:Stop()