From 56e2fa1763aaa5e803d8b4f60b9a7e9a622a8a2a Mon Sep 17 00:00:00 2001 From: paidforby <20746091+paidforby@users.noreply.github.com> Date: Tue, 2 Apr 2024 17:41:22 -0400 Subject: [PATCH] Check that context is not null in onPortMessage, closely related to #142 --- .../main/java/ie/equalit/ceno/browser/BaseBrowserFragment.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/ie/equalit/ceno/browser/BaseBrowserFragment.kt b/app/src/main/java/ie/equalit/ceno/browser/BaseBrowserFragment.kt index 91750f6f8..44c9760ed 100644 --- a/app/src/main/java/ie/equalit/ceno/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/ie/equalit/ceno/browser/BaseBrowserFragment.kt @@ -700,6 +700,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit override fun onPortMessage( message: Any, port: WebExtension.Port ) { + if (context == null) + return requireContext().components.core.store.state.selectedTab?.let { tab -> // the percentage progress for the webpage val webPageLoadProgress = tab.content.progress ?: 0