From b57fb87f50c14633947e78bb4a5b2e04170669be Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Thu, 16 May 2024 15:45:48 +0300 Subject: [PATCH] Add lifecycle check to the featured image confirmation dialog --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index d4c8c63b0770..3b81df497d4b 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -30,6 +30,7 @@ import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; +import androidx.lifecycle.Lifecycle.State; import androidx.lifecycle.LiveData; import com.android.volley.toolbox.ImageLoader; @@ -900,6 +901,10 @@ public void onClick(DialogInterface dialog, int id) { @UiThread public void showFeaturedImageConfirmationDialog(final int mediaId) { + if (!getLifecycle().getCurrentState().isAtLeast(State.CREATED)) { + return; + } + GutenbergDialogFragment dialog = new GutenbergDialogFragment(); dialog.initialize( TAG_REPLACE_FEATURED_DIALOG,