Skip to content

Commit

Permalink
Merge pull request #20954 from wordpress-mobile/issue/20953-fix-NPE-o…
Browse files Browse the repository at this point in the history
…nPostUploaded

Fix NPE in EditPostActivty onPostUploaded
  • Loading branch information
zwarm authored Jun 7, 2024
2 parents 721f73d + 08efcdc commit 5ce39e0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3813,7 +3813,12 @@ class EditPostActivity : LocaleAwareActivity(), EditorFragmentActivity, EditorIm
@Subscribe(threadMode = ThreadMode.MAIN)
fun onPostUploaded(event: OnPostUploaded) {
val post: PostModel? = event.post
if (post != null && post.id == editPostRepository.id) {

// Check if editPostRepository is initialized
val editPostRepositoryInitialized = this::editPostRepository.isInitialized
val editPostId = if (editPostRepositoryInitialized) editPostRepository.getPost()?.id else null

if (post != null && post.id == editPostId) {
if (!isRemotePreviewingFromEditor) {
// We are not remote previewing a post: show snackbar and update post status if needed
val snackbarAttachView = findViewById<View>(R.id.editor_activity)
Expand Down

0 comments on commit 5ce39e0

Please sign in to comment.