From eb30328beb4951c458b24e6b1776d4b4895806f1 Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Wed, 26 Jul 2017 16:14:39 +0200 Subject: [PATCH] fix(web_push_notification_worker): Guard against deleted notifications (#4379) --- app/workers/web_push_notification_worker.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/workers/web_push_notification_worker.rb b/app/workers/web_push_notification_worker.rb index da4043ddbd..51b8daae7c 100644 --- a/app/workers/web_push_notification_worker.rb +++ b/app/workers/web_push_notification_worker.rb @@ -9,6 +9,8 @@ class WebPushNotificationWorker session_activation = SessionActivation.find(session_activation_id) notification = Notification.find(notification_id) + return if session_activation.nil? || notification.nil? + begin session_activation.web_push_subscription.push(notification) rescue Webpush::InvalidSubscription, Webpush::ExpiredSubscription => e