diff --git a/lib/util/cleanup_url.dart b/lib/util/cleanup_url.dart index 6f3f610..f8182fd 100644 --- a/lib/util/cleanup_url.dart +++ b/lib/util/cleanup_url.dart @@ -1,7 +1,12 @@ /// Returns host of a url without a leading 'www.' or protocol if present also /// removes trailing '/' -String cleanUpUrl(String url) => - urlHost(url.startsWith('https://') ? url : 'https://$url'); +String cleanUpUrl(String url) { + try { + return urlHost(url.startsWith('https://') ? url : 'https://$url'); + } on FormatException catch (_) { + return ''; + } +} // Returns host of a url without a leading 'www.' if present String urlHost(String url) {