diff mod_default_bookmarks/mod_default_bookmarks.lua @ 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 ee2463fbf794
children 3f6711c1c66a
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