From 6162e6e919c9c9dac247fc8172b070c6d303e768 Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Fri, 7 Jun 2024 10:46:54 -0400 Subject: [PATCH] Safely access editPostRepository.id --- .../java/org/wordpress/android/ui/posts/EditPostActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt index 6933c9c0bf12..2090abec6cd0 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt @@ -3813,7 +3813,9 @@ 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) { + val editPostId = editPostRepository.getPost()?.id + + 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(R.id.editor_activity)