From 03dd509075f30d4bf3dfd6af4194d8af4f308e13 Mon Sep 17 00:00:00 2001 From: David Langley Date: Mon, 26 Jul 2021 11:39:45 +0100 Subject: [PATCH] Fix Crash when opening the new Room Notification Settings Screen (Not yet released) (#4599) --- CHANGES.rst | 1 + .../RoomNotificationsSettingsService.swift | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 325adf066..9713595c8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,7 @@ Changes to be released in next version 🐛 Bugfix * Room: Fixed mentioning users from room info member details (#4583) * Settings: Disabled autocorrection when entering an identity server (#4593). + * Room Notification Settings: Fix Crash when opening the new Room Notification Settings Screen (Not yet released) (#4599). ⚠️ API Changes * diff --git a/Riot/Modules/Room/NotificationSettings/RoomNotificationsSettingsService.swift b/Riot/Modules/Room/NotificationSettings/RoomNotificationsSettingsService.swift index 1bd0e4b6b..b62c7ea60 100644 --- a/Riot/Modules/Room/NotificationSettings/RoomNotificationsSettingsService.swift +++ b/Riot/Modules/Room/NotificationSettings/RoomNotificationsSettingsService.swift @@ -264,11 +264,17 @@ fileprivate extension MXRoom { } var overridePushRule: MXPushRule? { - getRoomRule(from: mxSession.notificationCenter.rules.global.override) + guard let overrideRules = mxSession.notificationCenter.rules.global.override else { + return nil + } + return getRoomRule(from: overrideRules) } var roomPushRule: MXPushRule? { - getRoomRule(from: mxSession.notificationCenter.rules.global.room) + guard let roomRules = mxSession.notificationCenter.rules.global.room else { + return nil + } + return getRoomRule(from: roomRules) } var notificationState: RoomNotificationState {