# HG changeset patch # User Kim Alvefur # Date 1431912713 -7200 # Node ID 0697fbef9134f60b6d2b86f8d01cea6dec0a9a5a # Parent 985e05ac833b851335d76a3a223a542a8a3323ae mod_mamsub: Prevent nil indexing if message is added to archive of an offline user diff -r 985e05ac833b -r 0697fbef9134 mod_mamsub/mod_mamsub.lua --- a/mod_mamsub/mod_mamsub.lua Mon May 18 03:27:08 2015 +0200 +++ b/mod_mamsub/mod_mamsub.lua Mon May 18 03:31:53 2015 +0200 @@ -47,7 +47,8 @@ end); module:hook("archive-message-added", function (event) - local mamsub_sessions = host_sessions[event.for_user].mamsub_sessions; + local user_session = host_sessions[event.for_user]; + local mamsub_sessions = user_session and user_session.mamsub_sessions; if not mamsub_sessions then return end; local for_broadcast = st.message():tag("mamsub", { xmlns = xmlns_mamsub })