For #8743: Fix baseBrowserFragment crash

fennec/beta
Sawyer Blatz 4 years ago committed by Emily Kager
parent 680249f724
commit 82979afb48

@ -460,10 +460,12 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
private fun adjustBackgroundAndNavigate(directions: NavDirections) {
context?.let {
engineView.captureThumbnail { bitmap ->
viewLifecycleOwner.lifecycleScope.launch {
// isAdded check is necessary because of a bug in viewLifecycleOwner. See AC#3828
if (!this@BaseBrowserFragment.isAdded) return@launch
viewLifecycleOwner.lifecycleScope.launch {
// isAdded check is necessary because of a bug in viewLifecycleOwner. See AC#3828
if (!this@BaseBrowserFragment.isAdded) return@launch
engineView.captureThumbnail { bitmap ->
if (!this@BaseBrowserFragment.isAdded) return@captureThumbnail
// If the bitmap is null, the best we can do to reduce the flash is set transparent
swipeRefresh.background = bitmap?.toDrawable(it.resources)

Loading…
Cancel
Save