Mercurial > prosody-modules
comparison mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 2054:b7c528027762
mod_storage_xmlarchive: Only try to close xmlfile if it has been opened (fixes traceback with limit=0)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 28 Feb 2016 16:23:30 +0100 |
| parents | 7c61ab512d0b |
| children | 13a8bbf256dd |
comparison
equal
deleted
inserted
replaced
| 2053:40056a27f394 | 2054:b7c528027762 |
|---|---|
| 97 end | 97 end |
| 98 local items, xmlfile; | 98 local items, xmlfile; |
| 99 local first_item, last_item; | 99 local first_item, last_item; |
| 100 | 100 |
| 101 return function () | 101 return function () |
| 102 if limit and count >= limit then xmlfile:close() return; end | 102 if limit and count >= limit then if xmlfile then xmlfile:close() end return; end |
| 103 local filename; | 103 local filename; |
| 104 | 104 |
| 105 for d = start_day, last_day, step do | 105 for d = start_day, last_day, step do |
| 106 if d ~= start_day or not items then | 106 if d ~= start_day or not items then |
| 107 module:log("debug", "Loading items from %s", dates[d]); | 107 module:log("debug", "Loading items from %s", dates[d]); |
