From 580b7620c545d102d2f884fec28db2c9f86f545c Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 12 Jul 2018 22:06:32 +0800 Subject: [PATCH] Suppress errors --- .../main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt | 2 +- .../be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt index 951f4054..0dfa92f2 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt @@ -106,7 +106,7 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() { } private fun startFailure(e: Exception?) { - Crashlytics.logException(e) + if (e?.message != "Caller already has an active LocalOnlyHotspot request") Crashlytics.logException(e) updateNotification() ServiceNotification.stopForeground(this@LocalOnlyHotspotService) stopSelf() diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt index a20600a6..fb0664f7 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt @@ -34,6 +34,9 @@ class P2pSupplicantConfiguration { val result = match.groupValues[2] + match.groupValues[3] // only one will match and hold non-empty value check(result.length in 8..63) result + } catch (e: NoSuchElementException) { + Toast.makeText(app, e.message, Toast.LENGTH_LONG).show() + null } catch (e: RuntimeException) { Crashlytics.log(Log.WARN, TAG, content) e.printStackTrace()