Skip to content

Commit 1e487ae

Browse files
authored
Fix rare crash in Reader when loading posts (#24815)
1 parent 1f0e644 commit 1e487ae

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Modules/Sources/WordPressKitObjC/ReaderPostServiceRemote.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#import "WPKitDateUtils.h"
66
#import "NSString+Helpers.h"
77
#import "WPMapFilterReduce.h"
8+
#import "WordPressComRestApiErrorDomain.h"
89

910
@import NSObject_SafeExpectations;
1011

@@ -209,6 +210,12 @@ - (void)fetchPostsFromEndpoint:(NSURL *)endpoint
209210
if (!success) {
210211
return;
211212
}
213+
if (![responseObject isKindOfClass:[NSDictionary class]]) {
214+
if (failure) {
215+
failure([NSError errorWithDomain:WordPressComRestApiErrorDomain code:-1 userInfo:nil]);
216+
}
217+
return;
218+
}
212219

213220
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
214221
// NOTE: Do all of this work on a background thread, then call success on the main thread.

RELEASE-NOTES.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
26.3
2-
-----
3-
4-
51
26.3
62
-----
73
* [*] Fix an issue with Notification Settings button not working in the Reader Subscriptions context menus for subscriptions [#24778]
4+
* [*] Fix rare crash in Reader when loading posts [#24815]
85

96
26.2
107
-----

0 commit comments

Comments
 (0)