Skip to content

Commit 79595dd

Browse files
committed
Check parameters of themepark:columns() function
1 parent 412d1c2 commit 79595dd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lua/themepark.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,17 @@ function themepark:columns(...)
133133
local cols = v
134134
if type(v) == 'string' then
135135
local elements = osm2pgsql.split_string(v, '/')
136-
cols = self._columns[elements[1]][elements[2]]
136+
if #elements ~= 2 then
137+
error("Use 'theme/column' format or table with columns as parameters in columns() function", 2)
138+
end
139+
local column_theme = self._columns[elements[1]]
140+
if not column_theme then
141+
error("Unknown column theme '" .. elements[1] .. "'", 2)
142+
end
143+
if not column_theme[elements[2]] then
144+
error("Unknown column '" .. elements[2] .. "' in theme '" .. elements[1] .. "'", 2)
145+
end
146+
cols = column_theme[elements[2]]
137147
end
138148
for _, c in ipairs(cols) do
139149
table.insert(columns, c)

0 commit comments

Comments
 (0)