From 332c3ef73d4da5e53a99acaebd491f6f3cbd7d00 Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Thu, 26 May 2022 23:55:54 +0200 Subject: [PATCH] Added try catch in case platform doesn't support opening URL in the browser --- src/main/kotlin/app/extensions/SystemUtils.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/extensions/SystemUtils.kt b/src/main/kotlin/app/extensions/SystemUtils.kt index 7f420e8..d6f1e7c 100644 --- a/src/main/kotlin/app/extensions/SystemUtils.kt +++ b/src/main/kotlin/app/extensions/SystemUtils.kt @@ -9,5 +9,10 @@ val systemSeparator: String by lazy { } fun openUrlInBrowser(url: String) { - Desktop.getDesktop().browse(URI(url)) + try { + Desktop.getDesktop().browse(URI(url)) + } catch (ex: Exception) { + println("Failed to open URL in browser") + ex.printStackTrace() + } } \ No newline at end of file