Skip to content

Commit ec6e5e5

Browse files
authored
Fix IllegalStateException when closing Duck.ai (#6839)
Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1211438741846582?focus=true ### Description - Checks `supportFragmentManager.isStateSaved` once the transition has completed to avoid `IllegalStateException` ### Steps to test this PR - [ ] Open Duck.ai - [ ] Close Duck.ai - [ ] Verify that the fragment animates out and hides
1 parent 7110b28 commit ec6e5e5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/src/main/java/com/duckduckgo/app/browser/BrowserActivity.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,11 @@ open class BrowserActivity : DuckDuckGoActivity() {
840840
val fragment = duckAiFragment
841841
if (fragment?.isVisible == true) {
842842
animateDuckAiFragmentOut {
843-
val transaction = supportFragmentManager.beginTransaction()
844-
transaction.hide(fragment)
845-
transaction.commit()
843+
if (!supportFragmentManager.isStateSaved) {
844+
val transaction = supportFragmentManager.beginTransaction()
845+
transaction.hide(fragment)
846+
transaction.commit()
847+
}
846848
}
847849
}
848850
}

0 commit comments

Comments
 (0)