From e8d763adc95f74a036232ccbca36b24a662b1256 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 5 Sep 2014 23:18:27 +0200 Subject: [auxiliary] robustify font property lookups This adresses an issue with entries in the font table that lack the common font structure (manually parsed fonts??). Subtable lookups are now guarded with nil-checks. Reported by Herbert Voss Signed-off-by: Philipp Gesang --- src/luaotfload-auxiliary.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/luaotfload-auxiliary.lua') diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua index 89bf51b..b05d491 100644 --- a/src/luaotfload-auxiliary.lua +++ b/src/luaotfload-auxiliary.lua @@ -417,7 +417,9 @@ least one feature. local provides_script = function (font_id, asked_script) asked_script = stringlower(asked_script) if font_id and font_id > 0 then - local fontdata = identifiers[font_id].shared.rawdata + local tfmdata = identifiers[font_id] if not tfmdata then return false end + local shared = tfmdata.shared if not shared then return false end + local fontdata = shared.rawdata if not fontdata then return false end if fontdata then local fontname = fontdata.metadata.fontname local features = fontdata.resources.features @@ -455,7 +457,9 @@ local provides_language = function (font_id, asked_script, asked_language) asked_script = stringlower(asked_script) asked_language = stringlower(asked_language) if font_id and font_id > 0 then - local fontdata = identifiers[font_id].shared.rawdata + local tfmdata = identifiers[font_id] if not tfmdata then return false end + local shared = tfmdata.shared if not shared then return false end + local fontdata = shared.rawdata if not fontdata then return false end if fontdata then local fontname = fontdata.metadata.fontname local features = fontdata.resources.features @@ -527,7 +531,9 @@ local provides_feature = function (font_id, asked_script, asked_feature = lpegmatch(strip_garbage, asked_feature) if font_id and font_id > 0 then - local fontdata = identifiers[font_id].shared.rawdata + local tfmdata = identifiers[font_id] if not tfmdata then return false end + local shared = tfmdata.shared if not shared then return false end + local fontdata = shared.rawdata if not fontdata then return false end if fontdata then local features = fontdata.resources.features local fontname = fontdata.metadata.fontname -- cgit v1.2.3