1
0
Fork 0

Closes #4671: Fix a potential NPE in BookmarkFragment

master
Grisha Kruglov 2019-08-09 17:43:48 -07:00 committed by Christian Sadilek
parent 634ee184a6
commit b38b94ed79
1 changed files with 5 additions and 1 deletions

View File

@ -237,7 +237,11 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler, Accou
}
private suspend fun refreshBookmarks() {
context?.bookmarkStorage()?.getTree(bookmarkStore.state.tree!!.guid, false).withOptionalDesktopFolders(context)
// The bookmark tree in our 'state' can be null - meaning, no bookmark tree has been selected.
// If that's the case, we don't know what node to refresh, and so we bail out.
// See https://github.com/mozilla-mobile/fenix/issues/4671
val currentGuid = bookmarkStore.state.tree?.guid ?: return
context?.bookmarkStorage()?.getTree(currentGuid, false).withOptionalDesktopFolders(context)
?.let { node ->
var rootNode = node
pendingBookmarksToDelete.forEach {