changeset 2749:9756211fcbe3

mod_cloud_notify: Fix small bug. See https://github.com/ChatSecure/ChatSecure-iOS/issues/770#issuecomment-323534057 for a description of the bug.
author tmolitor <thilo@eightysoft.de>
date Tue, 22 Aug 2017 20:25:58 +0200
parents ff0495909d4e
children 1d139e33c502
files mod_cloud_notify/mod_cloud_notify.lua
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_cloud_notify/mod_cloud_notify.lua	Tue Aug 22 20:10:10 2017 +0200
+++ b/mod_cloud_notify/mod_cloud_notify.lua	Tue Aug 22 20:25:58 2017 +0200
@@ -77,10 +77,12 @@
 				if push_errors[push_identifier] >= max_push_errors then
 					module:log("warn", "Disabling push notifications for identifier '%s'", push_identifier);
 					-- remove push settings from sessions
-					for _, session in pairs(host_sessions[node].sessions) do
-						if session.push_identifier == push_identifier then
-							session.push_identifier = nil;
-							session.push_settings = nil;
+					if host_sessions[node] then
+						for _, session in pairs(host_sessions[node].sessions) do
+							if session.push_identifier == push_identifier then
+								session.push_identifier = nil;
+								session.push_settings = nil;
+							end
 						end
 					end
 					-- save changed global config