From bd52e0502dbb3bb92193b00d4894ee7e14de3787 Mon Sep 17 00:00:00 2001 From: Ludovicus Date: Sat, 20 Jul 2019 16:58:16 -0400 Subject: [PATCH] CF#448: Protect RemoveWaypoint() from non-table inputs. --- TomTom.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TomTom.lua b/TomTom.lua index c6fea07..2fe1c43 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -656,6 +656,7 @@ function TomTom:InitializeDropdown(uid) end function TomTom:UIDIsSaved(uid) + if type(uid) ~= "table" then error("TomTom:UIDIsSaved(uid) UID is not a table."); end local data = uid if data then local key = TomTom:GetKey(data) @@ -669,6 +670,7 @@ function TomTom:UIDIsSaved(uid) end function TomTom:SendWaypoint(uid, channel) + if type(uid) ~= "table" then error("TomTom:SendWaypoint(uid) UID is not a table."); end local data = uid local m, x, y = unpack(data) local msg = string.format("%d:%f:%f:%s", m, x, y, data.title or "") @@ -783,6 +785,7 @@ end local function noop() end function TomTom:RemoveWaypoint(uid) + if type(uid) ~= "table" then error("TomTom:RemoveWaypoint(uid) UID is not a table."); end local data = uid self:ClearWaypoint(uid) @@ -937,6 +940,7 @@ end -- Check to see if a given uid/waypoint is actually set somewhere function TomTom:IsValidWaypoint(waypoint) + if type(waypoint) ~= "table" then error("TomTom:IsValidWaypoint(waypoint) UID is not a table."); end local m = waypoint[1] local key = self:GetKey(waypoint) if waypoints[m] and waypoints[m][key] then -- 1.7.9.5