From d2e389383564c7f7faf9dd93976e5d548924e1e4 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 28 Oct 2015 06:54:43 +0100 Subject: [db] fix behavior when starting with no data --- src/luaotfload-database.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/luaotfload-database.lua') diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 4af2451..1845643 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -354,7 +354,7 @@ local initialize_namedata = function (formats, created) status = { }, -- was: status; map abspath -> mapping mappings = { }, -- TODO: check if still necessary after rewrite names = { }, --- files = { }, -- created later + files = { }, -- created later meta = { created = created or now, formats = formats, @@ -2236,7 +2236,12 @@ end --doc]]-- --- string list -> size_t -local count_removed = function (old) +local count_removed = function (files) + if not files or not files.full then + logreport ("log", 4, "db", "Empty file store; no data to work with.") + return 0 + end + local old = files.full logreport ("log", 4, "db", "Checking removed files.") local nrem = 0 local nold = #old @@ -3161,7 +3166,7 @@ update_names = function (currentnames, force, dry_run) --- pass 2: read font files (normal case) or reuse information --- present in index - n_rem = count_removed (currentnames.files.full) + n_rem = count_removed (currentnames.files) n_new = retrieve_namedata (font_filenames, currentnames, -- cgit v1.2.3