[fenix] For issue https://github.com/mozilla-mobile/fenix/issues/22537 crash: BookmarkFragment is attached to a context

pull/600/head
Arturo Mejia 3 years ago committed by mergify[bot]
parent 1e1de90c7d
commit 1284096722

@ -261,10 +261,13 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
} }
private suspend fun loadBookmarkNode(guid: String): BookmarkNode? = withContext(IO) { private suspend fun loadBookmarkNode(guid: String): BookmarkNode? = withContext(IO) {
// Only runs if the fragment is attached same as [runIfFragmentIsAttached]
context?.let {
requireContext().bookmarkStorage requireContext().bookmarkStorage
.getTree(guid, false) .getTree(guid, false)
?.let { desktopFolders.withOptionalDesktopFolders(it) } ?.let { desktopFolders.withOptionalDesktopFolders(it) }
} }
}
private suspend fun refreshBookmarks() { private suspend fun refreshBookmarks() {
// The bookmark tree in our 'state' can be null - meaning, no bookmark tree has been selected. // The bookmark tree in our 'state' can be null - meaning, no bookmark tree has been selected.

Loading…
Cancel
Save