Changeset

4978:4c8b66da4dec

mod_default_bookmarks: Bail on empty 'default_bookmarks' to fix traceback Ipairs fails on nil if the option is unset Thanks more666p0wer for reporting
author Kim Alvefur <zash@zash.se>
date Mon, 25 Jul 2022 19:28:38 +0200
parents 4977:3bd725430f40
children 4979:8f77452abc59
files mod_default_bookmarks/mod_default_bookmarks.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_default_bookmarks/mod_default_bookmarks.lua	Thu Jul 21 18:06:31 2022 +0200
+++ b/mod_default_bookmarks/mod_default_bookmarks.lua	Mon Jul 25 19:28:38 2022 +0200
@@ -80,6 +80,9 @@
 			end
 			local service = mod_pep.get_pep_service(session.username);
 			local bookmarks = module:get_option_array("default_bookmarks");
+			if not bookmarks or #bookmarks == 0 then
+				return;
+			end
 			local ns = event.version or "urn:xmpp:bookmarks:1";
 			for i, bookmark in ipairs(bookmarks) do
 				local bm_jid = jid.prep(bookmark.jid);