Changeset

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 2418:ef95853cf900
children 2420:309db11494c2
files mod_block_strangers/mod_block_strangers.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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)