From 02355df986b409ae557beb26cfd8dbdcdaa95e08 Mon Sep 17 00:00:00 2001 From: Brayan Oliveira <69634269+brayandso@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:04:33 -0300 Subject: [PATCH] fix: check if HeaderFragment is attached parentFragmentManager may throw if not --- .../src/main/java/com/ichi2/anki/preferences/HeaderFragment.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/HeaderFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/HeaderFragment.kt index 54f6465b41af..13f798c7e631 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/HeaderFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/HeaderFragment.kt @@ -68,6 +68,7 @@ class HeaderFragment : PreferenceFragmentCompat(), TitleProvider { } parentFragmentManager.addOnBackStackChangedListener { + if (!isAdded) return@addOnBackStackChangedListener val fragment = parentFragmentManager.findFragmentById(R.id.settings_container) ?: return@addOnBackStackChangedListener