diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-05 16:17:45 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-05 16:17:45 +0100 |
commit | 8fbfd38b52e4e4c6381d10610211a5e66140c0c1 (patch) | |
tree | d0476ad96deb000ca7551ce2ef56dc4c85ead33d /luaotfload-tool.lua | |
parent | 0228ec5a8a6d969c94cc2f5b7befd0cdb17a3c63 (diff) | |
download | luaotfload-8fbfd38b52e4e4c6381d10610211a5e66140c0c1.tar.gz |
[tool] protect --list and --field against invalid queries
Diffstat (limited to 'luaotfload-tool.lua')
-rwxr-xr-x | luaotfload-tool.lua | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index 17d9399..3bae175 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -892,9 +892,17 @@ local get_fields get_fields = function (entry, fields, acc, n) local tmp = entry for i = 1, #chain - 1 do tmp = tmp [chain [i]] + if not tmp then + --- invalid field + break + end + end + if tmp then + local value = tmp [chain [#chain]] + acc[#acc+1] = value or false + else + acc[#acc+1] = false end - local value = tmp [chain [#chain]] - acc[#acc+1] = value or false return get_fields (entry, fields, acc, n+1) end return acc @@ -997,8 +1005,11 @@ actions.list = function (job) local chain = stringsplit (criterion, "->") for i = 1, #chain - 1 do tmp = tmp [chain [i]] + if not tmp then + break + end end - local value = tmp [chain [#chain]] + local value = tmp and tmp [chain [#chain]] or "<none>" if value then --value = tostring(value) local entries = by_category[value] |