From 278ed658b65be1a83cb279d8b857eab4efd3048e Mon Sep 17 00:00:00 2001 From: mcarare Date: Tue, 26 Jan 2021 16:38:36 +0200 Subject: [PATCH] For #17635: Check if id corresponds to a custom tab before removing it. --- .../org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt b/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt index eee8af3fcc..689a6aa4c3 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt @@ -102,7 +102,8 @@ open class ExternalAppBrowserActivity : HomeActivity() { // exists then remove it now to free all its resources. Once this activity is finished // then there's no way to get back to it other than relaunching it. val tabId = getExternalTabId() - if (tabId != null) { + val customTab = tabId?.let { components.core.store.state.findCustomTab(it) } + if (tabId != null && customTab != null) { components.useCases.customTabsUseCases.remove(tabId) } }