diff options
| author | Philipp Gesang <phg@phi-gamma.net> | 2015-10-28 06:54:43 +0100 | 
|---|---|---|
| committer | Philipp Gesang <phg@phi-gamma.net> | 2015-10-28 06:54:43 +0100 | 
| commit | d2e389383564c7f7faf9dd93976e5d548924e1e4 (patch) | |
| tree | 62647f404dfdcd746eab6aec6d7f9f0da929cf9e | |
| parent | 120c852ccd7a1579310ed855a4d8b1322a1f9d09 (diff) | |
| download | luaotfload-d2e389383564c7f7faf9dd93976e5d548924e1e4.tar.gz | |
[db] fix behavior when starting with no data
| -rw-r--r-- | src/luaotfload-database.lua | 11 | 
1 files changed, 8 insertions, 3 deletions
| 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, | 
