diff --git a/CHANGES.md b/CHANGES.md index cc6eb234a..6a9aa8313 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,10 @@ +## Changes in 0.27.4 (2023-11-28) + +🐛 Bugfixes + +- Fix unhandled callback when the session is nil. ([#1833](https://github.com/matrix-org/matrix-ios-sdk/pull/1833)) + + ## Changes in 0.27.3 (2023-10-04) 🐛 Bugfixes diff --git a/MatrixSDK.podspec b/MatrixSDK.podspec index abcfc24f7..a86e1a6fb 100644 --- a/MatrixSDK.podspec +++ b/MatrixSDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "MatrixSDK" - s.version = "0.27.3" + s.version = "0.27.4" s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)" s.description = <<-DESC diff --git a/MatrixSDK/Data/MXRoomState.m b/MatrixSDK/Data/MXRoomState.m index 12ed90b8e..0f19cd8a8 100644 --- a/MatrixSDK/Data/MXRoomState.m +++ b/MatrixSDK/Data/MXRoomState.m @@ -120,23 +120,31 @@ + (void)loadRoomStateFromStore:(id)store { [store stateOfRoom:roomId success:^(NSArray * _Nonnull stateEvents) { if (!stateEvents.count) { - MXLogWarning(@"[MXRoomState] loadRoomStateFromStore(%@): No state events stored, loading from api", logId); + MXLogWarning(@"[MXRoomState] loadRoomStateFromStore(%@): No state events stored, loading from API", logId); - [matrixSession.matrixRestClient stateOfRoom:roomId success:^(NSArray *JSONData) { - NSArray *events = [MXEvent modelsFromJSON:JSONData]; - MXLogDebug(@"[MXRoomState] loadRoomStateFromStore(%@): Loaded %lu events from api", logId, events.count); - - [roomState handleStateEvents:events]; - onComplete(roomState); - } failure:^(NSError *error) { - NSDictionary *details = @{ - @"log_id": logId ?: @"unknown", - @"error": error ?: @"unknown" - }; - MXLogErrorDetails(@"[MXRoomState] loadRoomStateFromStore: Failed to load any events from api", details); - + if (!matrixSession) + { + MXLogError(@"[MXRoomState] loadRoomStateFromStore: Missing session, unable to load from API") onComplete(roomState); - }]; + } + else + { + [matrixSession.matrixRestClient stateOfRoom:roomId success:^(NSArray *JSONData) { + NSArray *events = [MXEvent modelsFromJSON:JSONData]; + MXLogDebug(@"[MXRoomState] loadRoomStateFromStore(%@): Loaded %lu events from api", logId, events.count); + + [roomState handleStateEvents:events]; + onComplete(roomState); + } failure:^(NSError *error) { + NSDictionary *details = @{ + @"log_id": logId ?: @"unknown", + @"error": error ?: @"unknown" + }; + MXLogErrorDetails(@"[MXRoomState] loadRoomStateFromStore: Failed to load any events from API", details); + + onComplete(roomState); + }]; + } } else { MXLogDebug(@"[MXRoomState] loadRoomStateFromStore(%@): Initializing with %lu state events", logId, stateEvents.count); diff --git a/MatrixSDK/MatrixSDKVersion.m b/MatrixSDK/MatrixSDKVersion.m index f52dff165..bb04b8853 100644 --- a/MatrixSDK/MatrixSDKVersion.m +++ b/MatrixSDK/MatrixSDKVersion.m @@ -16,4 +16,4 @@ #import -NSString *const MatrixSDKVersion = @"0.27.3"; +NSString *const MatrixSDKVersion = @"0.27.4";