mod_cloud_notify: Fix small bug.
authortmolitor <thilo@eightysoft.de>
Tue, 22 Aug 2017 20:25:58 +0200
changeset 2753 9756211fcbe3
parent 2752 ff0495909d4e
child 2754 1d139e33c502
mod_cloud_notify: Fix small bug. See https://github.com/ChatSecure/ChatSecure-iOS/issues/770#issuecomment-323534057 for a description of the bug.
mod_cloud_notify/mod_cloud_notify.lua
--- 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