From 8f8ede2c8cb11caaa80741735ee1bec37ce41c83 Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 26 Jun 2020 05:00:17 +0800 Subject: [PATCH] Fix more crashes --- .../be/mygod/vpnhotspot/RepeaterService.kt | 2 +- .../mygod/vpnhotspot/net/monitor/IpMonitor.kt | 2 +- .../net/wifi/WifiApDialogFragment.kt | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index 19d7d30d..5f5b8671 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -249,7 +249,7 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene private fun onPersistentGroupsChanged() = launch { val ownerAddress = lastMac?.let(MacAddressCompat.Companion::fromString) ?: try { P2pSupplicantConfiguration().apply { init() }.bssid - } catch (e: RuntimeException) { + } catch (e: Exception) { Timber.d(e) null } ?: return@launch diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/IpMonitor.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/IpMonitor.kt index a9887af6..e4d5b187 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/IpMonitor.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/monitor/IpMonitor.kt @@ -159,7 +159,7 @@ abstract class IpMonitor { val lines = result.out.lines() if (lines.any { errorMatcher.containsMatchIn(it) }) throw IOException(result.out) processLines(lines.asSequence()) - } catch (e: RuntimeException) { + } catch (e: Exception) { app.logEvent("ip_su_poll_failure") { param("cause", e.message.toString()) } Timber.d(e) } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt index b7f4d229..3f635853 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt @@ -84,19 +84,21 @@ class WifiApDialogFragment : AlertDialogFragment