diff mod_block_strangers/mod_block_strangers.lua @ 2419:045d594a3707

mod_block_strangers: Check that the table of directed presence exists before indexing it (fixes traceback)
author Kim Alvefur <zash@zash.se>
date Mon, 19 Dec 2016 07:43:28 +0100
parents 09f6e1a09b2b
children 38365c1f1fe4
line wrap: on
line diff
--- a/mod_block_strangers/mod_block_strangers.lua	Fri Dec 16 03:30:46 2016 +0100
+++ b/mod_block_strangers/mod_block_strangers.lua	Mon Dec 19 07:43:28 2016 +0100
@@ -7,7 +7,12 @@
 
 local function has_directed_presence(user, jid)
 	local session = full_sessions[user];
-	return session and session.directed[jid];
+	if session then
+		local directed = session.directed;
+		if directed then
+			return directed[jid];
+		end
+	end
 end
 
 function check_subscribed(event)