From 05bde9b24e47e37a144f29dc9417b1b0f4b398f6 Mon Sep 17 00:00:00 2001
From: tamaina <tamaina@hotmail.co.jp>
Date: Sat, 24 Apr 2021 01:37:29 +0900
Subject: [PATCH] fix warn

---
 src/client/sw/sw.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/client/sw/sw.ts b/src/client/sw/sw.ts
index 247269f25b..4c651117c7 100644
--- a/src/client/sw/sw.ts
+++ b/src/client/sw/sw.ts
@@ -59,17 +59,17 @@ self.addEventListener('push', ev => {
 
 			case 'readAllNotifications':
 				for (const n of await self.registration.getNotifications()) {
-					if (n.data.type === 'notification') n.close();
+					if (n?.data?.type === 'notification') n.close();
 				}
 				break;
 			case 'readAllMessagingMessages':
 				for (const n of await self.registration.getNotifications()) {
-					if (n.data.type === 'unreadMessagingMessage') n.close();
+					if (n?.data?.type === 'unreadMessagingMessage') n.close();
 				}
 				break;
 			case 'readNotifications':
 				for (const n of await self.registration.getNotifications()) {
-					if (data.body.notificationIds?.includes(n.data.body.id)) {
+					if (data.body?.notificationIds?.includes(n.data.body.id)) {
 						n.close();
 					}
 				}