From 2144889333ddc6fcd4293097ec884b9bd460c4ac Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 29 Mar 2010 07:24:48 +0200 Subject: Make sure names file exist before loading it To protect against lua complaining about non existing file. --- otfl-font-nms.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index 5a31c56..5431c20 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -35,7 +35,12 @@ end function names.load() local localpath = names.path.localdir .. names.path.basename local systempath = names.path.systemdir .. names.path.basename - local data = dofile(localpath) or dofile(systempath) + local data + if file.isreadable(localpath) then + data = dofile(localpath) + elseif file.isreadable(systempath) then + data = dofile(systempath) + end if data then if trace_loading then logs.report("load font", "loaded font names database: %s", foundname) -- cgit v1.2.3