Skip to content

Commit 34e191e

Browse files
Fix service worker crash (#1275)
1 parent 529601b commit 34e191e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/src/main/java/com/duckduckgo/app/browser/serviceworker/ServiceWorkerLifecycleObserver.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import androidx.lifecycle.LifecycleObserver
2323
import androidx.lifecycle.OnLifecycleEvent
2424
import com.duckduckgo.app.browser.RequestInterceptor
2525
import com.duckduckgo.app.global.exception.UncaughtExceptionRepository
26+
import timber.log.Timber
2627
import javax.inject.Inject
2728
import javax.inject.Singleton
2829

@@ -35,9 +36,13 @@ class ServiceWorkerLifecycleObserver @Inject constructor(
3536
@OnLifecycleEvent(Lifecycle.Event.ON_START)
3637
fun setServiceWorkerClient() {
3738
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
38-
ServiceWorkerController.getInstance().setServiceWorkerClient(
39-
BrowserServiceWorkerClient(requestInterceptor, uncaughtExceptionRepository)
40-
)
39+
try {
40+
ServiceWorkerController.getInstance().setServiceWorkerClient(
41+
BrowserServiceWorkerClient(requestInterceptor, uncaughtExceptionRepository)
42+
)
43+
} catch (e: Exception) {
44+
Timber.w(e.localizedMessage)
45+
}
4146
}
4247
}
4348
}

0 commit comments

Comments
 (0)