Skip to content

Commit

Permalink
fix: avoid back stack manipulation dismissing dialogs after state saved
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy authored and BrayanDSO committed Nov 25, 2024
1 parent 5220da8 commit 83b75bf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions AnkiDroid/src/main/java/com/ichi2/anki/AnkiActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,13 @@ open class AnkiActivity : AppCompatActivity, SimpleMessageDialogListener, Shortc

// Dismiss whatever dialog is showing
fun dismissAllDialogFragments() {
supportFragmentManager.popBackStack(
DIALOG_FRAGMENT_TAG,
FragmentManager.POP_BACK_STACK_INCLUSIVE
)
// trying to pop fragment manager back state crashes if state already saved
if (!supportFragmentManager.isStateSaved) {
supportFragmentManager.popBackStack(
DIALOG_FRAGMENT_TAG,
FragmentManager.POP_BACK_STACK_INCLUSIVE
)
}
}

/**
Expand Down

0 comments on commit 83b75bf

Please sign in to comment.