From 5e4b9fb15b316ca5578639374d4ae188026c4741 Mon Sep 17 00:00:00 2001 From: NerdNumber9 Date: Sun, 14 Apr 2019 00:34:49 -0400 Subject: [PATCH] Fix a crash that could occur in the incognito browser --- app/src/main/java/exh/ui/webview/WebViewActivity.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/exh/ui/webview/WebViewActivity.kt b/app/src/main/java/exh/ui/webview/WebViewActivity.kt index fab5c5990..22076c3a6 100644 --- a/app/src/main/java/exh/ui/webview/WebViewActivity.kt +++ b/app/src/main/java/exh/ui/webview/WebViewActivity.kt @@ -159,8 +159,14 @@ class WebViewActivity : BaseActivity() { android.R.id.home -> finish() R.id.action_refresh -> webview.reload() R.id.action_forward -> webview.goForward() - R.id.action_open_in_browser -> - startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(webview.url))) + R.id.action_open_in_browser -> { + val url = webview.url + if(url != null) { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) + } else { + toast("An error occurred while opening this page in your browser!") + } + } } return super.onOptionsItemSelected(item) }