# HG changeset patch # User Emmanuel Gil Peyrot # Date 1554214960 -7200 # Node ID 11629f04ddd04c4fa612e276d01139473802687d # Parent 1bb2a90398d3cf3653ca23f455fd38a014670a16 mod_bookmarks: Check for item-not-found and return empty Private XML. Fixes #1265 (thanks gerald and thebigfrog!) diff -r 1bb2a90398d3 -r 11629f04ddd0 mod_bookmarks/mod_bookmarks.lua --- a/mod_bookmarks/mod_bookmarks.lua Tue Apr 02 16:27:14 2019 +0200 +++ b/mod_bookmarks/mod_bookmarks.lua Tue Apr 02 16:22:40 2019 +0200 @@ -32,8 +32,13 @@ local service = mod_pep.get_pep_service(username); local ok, id, item = service:get_last_item("storage:bookmarks", session.full_jid); if not ok then - module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id); - session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); + if id == "item-not-found" then + module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid); + session.send(st.reply(stanza):add_child(query)); + else + module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id); + session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); + end return; end if not id or not item then