From f470723ece0d0f3403834341dcd30394151c8cdb Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Mon, 27 Feb 2023 16:07:22 +0200 Subject: [PATCH] Add try/catch block in case launch url throws a platform exception --- .../screens/settings/widgets/settings_link_provider_cell.dart | 4 +++- lib/view_model/support_view_model.dart | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/settings/widgets/settings_link_provider_cell.dart b/lib/src/screens/settings/widgets/settings_link_provider_cell.dart index 1b67f60e4..e64d6543b 100644 --- a/lib/src/screens/settings/widgets/settings_link_provider_cell.dart +++ b/lib/src/screens/settings/widgets/settings_link_provider_cell.dart @@ -30,6 +30,8 @@ class SettingsLinkProviderCell extends StandardListRow { color: Palette.blueCraiola)); static void _launchUrl(String url) async { - await launch(url, forceSafariVC: false); + try { + await launch(url, forceSafariVC: false); + } catch (e) {} } } diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart index 4e602089a..15c25968f 100644 --- a/lib/view_model/support_view_model.dart +++ b/lib/view_model/support_view_model.dart @@ -18,7 +18,9 @@ abstract class SupportViewModelBase with Store { RegularListItem( title: S.current.faq, handler: (BuildContext context) async { - await launch(url); + try { + await launch(url); + } catch (e) {} }, ), LinkListItem(