From 9b1c5ef4d58fc27a09134c4a319f9092c8dd5dd1 Mon Sep 17 00:00:00 2001 From: Colin Lee Date: Sun, 17 Feb 2019 13:10:29 -0600 Subject: [PATCH] [fenix] Fixes https://github.com/mozilla-mobile/fenix/issues/568: Crash on custom tabs menu if no other tabs are open --- .../org/mozilla/fenix/components/toolbar/ToolbarUIView.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt index 06e9eb296a..97bb031088 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarUIView.kt @@ -66,11 +66,14 @@ class ToolbarUIView( } with(view.context) { + val session = sessionId?.let { components.core.sessionManager.findSessionById(sessionId) } + ?: components.core.sessionManager.selectedSession + toolbarIntegration = ToolbarIntegration( this, view, ToolbarMenu(this, - requestDesktopStateProvider = { components.core.sessionManager.selectedSessionOrThrow.desktopMode }, + requestDesktopStateProvider = { session?.desktopMode ?: false }, onItemTapped = { actionEmitter.onNext(SearchAction.ToolbarMenuItemTapped(it)) } ), ShippedDomainsProvider().also { it.initialize(this) },