You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StackOverflowError: stack size 1039KB
at org.wordpress.android.fluxc.store.PageStore.getPageFromPost(PageStore.kt:168)
at org.wordpress.android.fluxc.store.PageStore.getPageFromPost$default(PageStore.kt:162)
at org.wordpress.android.fluxc.store.PageStore.getPageFromPost(PageStore.kt:172)
at org.wordpress.android.fluxc.store.PageStore.getPageFromPost$default(PageStore.kt:162)
at org.wordpress.android.fluxc.store.PageStore.getPageFromPost(PageStore.kt:172)
...
(95 additional frame(s) were not displayed)
The text was updated successfully, but these errors were encountered:
The code block below relies on the PageModel class and the getPageFromPost function itself for recursion.
See line val post = posts[postId]!! in PageStore.kt on FluxC, it means that the posts map does not contain a key equal to postId. To fix this, need to handle the case where posts[postId] is null. This code will return null if post is null. Alternatively, replace return null with appropriate error handling for this case:
private fun getPageFromPost(
postId: Long,
site: SiteModel,
posts: Map<Long, PostModel>,
skipLocalPages: Boolean = true
): PageModel? {
if (skipLocalPages && (postId <= 0L || !posts.containsKey(postId))) {
return null
}
val post = posts[postId]
if (post == null) {
// Handle the case where post is null, for example:
return null
}
return PageModel(post, site, getPageFromPost(post.parentId, site, posts))
}
Sentry Issue: JETPACK-ANDROID-QXQ
The text was updated successfully, but these errors were encountered: