From 1357488fad354f8e235bf56211758b7fe8e45539 Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 7 Aug 2020 07:11:55 +0800 Subject: [PATCH] Prevent bad system crashing app --- mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt index 05320aa7..1397bcb8 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetherType.kt @@ -46,7 +46,12 @@ enum class TetherType(@DrawableRes val icon: Int) { if (it == 0) { if (name == "config_tether_wigig_regexs") Timber.i("$name is empty") else Timber.w(Exception(name)) emptyList() - } else second.getStringArray(it).filterNotNull().map { it.toPattern() } + } else try { + second.getStringArray(it).filterNotNull().map { it.toPattern() } + } catch (_: Resources.NotFoundException) { + Timber.w(Exception("$name not found")) + emptyList() + } } @RequiresApi(30)