Software /
code /
prosody
Comparison
plugins/mod_storage_internal.lua @ 8143:c4c159953c72
mod_storage_internal: Handle case of empty item store when deleting (fixes #910)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 14 May 2017 17:31:50 +0200 |
parent | 8142:13e075549cb3 |
child | 8173:3ff99d49082f |
comparison
equal
deleted
inserted
replaced
8142:13e075549cb3 | 8143:c4c159953c72 |
---|---|
137 end | 137 end |
138 for k in pairs(query) do | 138 for k in pairs(query) do |
139 if k ~= "end" then return nil, "unsupported-query-field"; end | 139 if k ~= "end" then return nil, "unsupported-query-field"; end |
140 end | 140 end |
141 local items, err = datamanager.list_load(username, host, self.store); | 141 local items, err = datamanager.list_load(username, host, self.store); |
142 if not items then return items, err; end | 142 if not items then |
143 if err then | |
144 return items, err; | |
145 end | |
146 -- Store is empty | |
147 return 0; | |
148 end | |
143 items = array(items); | 149 items = array(items); |
144 local count_before = #items; | 150 local count_before = #items; |
145 items:filter(function (item) | 151 items:filter(function (item) |
146 return item.when > query["end"]; | 152 return item.when > query["end"]; |
147 end); | 153 end); |