Changeset

4856:b3f0f82af5a2

mod_default_bookmarks: Fix mod_bookmarks capability check Too many variables named too close to 'bookmarks' here...
author Kim Alvefur <zash@zash.se>
date Sat, 08 Jan 2022 00:01:29 +0100
parents 4855:0c9128145bcf
children 4857:3f6711c1c66a
files mod_default_bookmarks/mod_default_bookmarks.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_default_bookmarks/mod_default_bookmarks.lua	Fri Jan 07 23:33:12 2022 +0100
+++ b/mod_default_bookmarks/mod_default_bookmarks.lua	Sat Jan 08 00:01:29 2022 +0100
@@ -52,9 +52,11 @@
 	local mod_bookmarks = module:depends "bookmarks";
 	local function on_bookmarks_empty(event)
 		local session = event.session;
-		local bookmarks = get_default_bookmarks(session.username);
-		if bookmarks.publish_to_pep then
-			mod_bookmarks.publish_to_pep(session.full_jid, bookmarks);
+		if mod_bookmarks.publish_to_pep then
+			local bookmarks = get_default_bookmarks(session.username);
+			if bookmarks then
+				mod_bookmarks.publish_to_pep(session.full_jid, bookmarks);
+			end
 		else
 			module:log("error", "Method for publishing legacy bookmarks not exposed by mod_bookmarks")
 		end