Both WebView screens send tapped links to the system browser without protection:
DocsViewerActivity.kt:69:
override fun shouldOverrideUrlLoading(
view: WebView?,
request: WebResourceRequest?
): Boolean {
request?.url?.let { url ->
val intent = Intent(Intent.ACTION_VIEW, url)
context.startActivity(intent)
return true
}
return false
}
BackupWebView.kt:75:
override fun shouldOverrideUrlLoading(
view: WebView?,
request: WebResourceRequest?
): Boolean {
request?.url?.let { url ->
coroutineScope.launch(Dispatchers.IO) {
val intent = Intent(Intent.ACTION_VIEW, url)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
}
return true
}
return false
}
If the device has no app that can handle the URL (no browser at all, an unusual scheme, etc.) startActivity raises ActivityNotFoundException. In DocsViewerActivity the exception propagates back through shouldOverrideUrlLoading and the docs viewer crashes. In BackupWebView the exception happens on a background coroutine and brings the process down even more abruptly.
Suggested fix
Wrap both calls in try { ... } catch (ActivityNotFoundException) { ... } and fall back to a short Toast (no_app_to_open_link). On the BackupWebView side switch to Main for the Toast since it's launched from Dispatchers.IO.
A PR with the two guards and the matching string is open at #76.
Both WebView screens send tapped links to the system browser without protection:
DocsViewerActivity.kt:69:BackupWebView.kt:75:If the device has no app that can handle the URL (no browser at all, an unusual scheme, etc.)
startActivityraisesActivityNotFoundException. InDocsViewerActivitythe exception propagates back throughshouldOverrideUrlLoadingand the docs viewer crashes. InBackupWebViewthe exception happens on a background coroutine and brings the process down even more abruptly.Suggested fix
Wrap both calls in
try { ... } catch (ActivityNotFoundException) { ... }and fall back to a short Toast (no_app_to_open_link). On theBackupWebViewside switch toMainfor the Toast since it's launched fromDispatchers.IO.A PR with the two guards and the matching string is open at #76.