Diff

mod_cloud_notify/mod_cloud_notify.lua @ 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
parent 2736:fff185e7ab73
child 2751:6b710a8bdf03
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