CF#448: Protect RemoveWaypoint() from non-table inputs.
Ludovicus [07-20-19 - 20:58]
CF#448: Protect RemoveWaypoint() from non-table inputs.
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