wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.97k stars 1.32k forks source link

NullPointerException #20948

Open sentry-io[bot] opened 4 months ago

sentry-io[bot] commented 4 months ago

Sentry Issue: WORDPRESS-ANDROID-2YSX

NullPointerException: None
    at org.wordpress.android.ui.posts.EditPostRepository.getFeaturedImageId(EditPostRepository.kt:84)
    get() = post!!.featuredImageId
    at org.wordpress.android.ui.posts.EditPostActivity.getGutenbergPropsBuilder(EditPostActivity.kt:2458)
    val featuredImageId = editPostRepository.featuredImageId.toInt()
    at org.wordpress.android.ui.posts.EditPostActivity.onXpostsSettingsCapability(EditPostActivity.kt:2451)
    (editorFragment as GutenbergEditorFragment).updateCapabilities(gutenbergPropsBuilder)
    at org.wordpress.android.ui.posts.EditPostActivity.access$updateOnSuccessfulUpload(EditPostActivity.kt:260)
    @Suppress("LargeClass")
    at org.wordpress.android.ui.posts.EditPostActivity.access$onXpostsSettingsCapability(EditPostActivity.kt:260)
    @Suppress("LargeClass")
...
(14 additional frame(s) were not displayed)
dangermattic commented 4 months ago

Thanks for reporting! 👍

sentry-io[bot] commented 4 months ago

Sentry Issue: JETPACK-ANDROID-S3H

zwarm commented 4 months ago

Investigation Notes

fun loadPostByLocalPostId(postId: Int) {
        reportTransactionState(true)
        post = postStore.getPostByLocalPostId(postId)
        savePostSnapshot()
        reportTransactionState(false)
    }

and

    fun loadPostByRemotePostId(remotePostId: Long, site: SiteModel) {
        reportTransactionState(true)
        post = postStore.getPostByRemotePostId(remotePostId, site)
        savePostSnapshot()
        reportTransactionState(false)
    }

Of course, if either of those methods I mentioned above are null it could throw a wrench into making a call to one of the properties. Not the best of situations.