From 816eddc89d1e8b64e31a5a74cfa7ecf624de28da 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 bc55a8adf8cf..8e47ab5197c0 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/HeaderFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/HeaderFragment.kt @@ -71,6 +71,7 @@ class HeaderFragment : PreferenceFragmentCompat(), TitleProvider { } parentFragmentManager.addOnBackStackChangedListener { + if (!isAdded) return@addOnBackStackChangedListener val fragment = parentFragmentManager.findFragmentById(R.id.settings_container) ?: return@addOnBackStackChangedListener