diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-04-24 14:12:28 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-04-24 14:12:28 +0200 |
commit | 61fcc90e47c36c7c8c8bf4a5d46c649942886462 (patch) | |
tree | 215af84ad76a0287fbdb17b6b75537f9cb4fd638 /src | |
parent | 8c3e40f3dc42ec1b5b6cce8f7ee5bbe7b66ddfd0 (diff) | |
download | luaotfload-61fcc90e47c36c7c8c8bf4a5d46c649942886462.tar.gz |
[aux] make name_of_slot API more robust
Diffstat (limited to 'src')
-rw-r--r-- | src/luaotfload-auxiliary.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua index fc2a191..347d9f8 100644 --- a/src/luaotfload-auxiliary.lua +++ b/src/luaotfload-auxiliary.lua @@ -305,11 +305,23 @@ local indices --- int -> (string | false) local name_of_slot = function (codepoint) + if not codepoint or type (codepoint) ~= "number" then + logreport ("both", 0, "aux", + "invalid parameters to name_of_slot (%s)", + tostring (codepoint)) + return false + end + if not indices then --- this will load the glyph list local unicodes = encodings.agl.unicodes - indices = table.swapped(unicodes) + if not unicodes or not next (unicodes)then + logreport ("both", 0, "aux", + "name_of_slot: failed to load the AGL.") + end + indices = table.swapped (unicodes) end - local glyphname = indices[codepoint] + + local glyphname = indices [codepoint] if glyphname then return glyphname end |