Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE in EditPostActivty onPostUploaded #20954

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading