Skip to content
Snippets Groups Projects
Commit 54378474 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Browser: prevent IllegalStateException

(cherry picked from commit c414eb1e)
parent dfff5c76
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ import androidx.appcompat.view.ActionMode
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
......@@ -208,6 +209,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
fun goBack(): Boolean {
val activity = activity ?: return false
if (!activity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) return false
if (!isRootDirectory && !activity.isFinishing && !activity.isDestroyed) activity.supportFragmentManager.popBackStack()
return !isRootDirectory
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment