From c64ce7793996e47b9234ca5a77882ddfecc7ce18 Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 17 Dec 2020 11:41:50 -0500 Subject: [PATCH] Fix index out of range --- mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index f82a3cf8..e14e7315 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -57,7 +57,9 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene @delegate:TargetApi(29) private val hasP2pValidateName by lazy { - val (y, m, _) = Build.VERSION.SECURITY_PATCH.split('-', limit = 3).map { it.toIntOrNull() } + val array = Build.VERSION.SECURITY_PATCH.split('-', limit = 3).map { it.toIntOrNull() } + val y = array.getOrNull(0) + val m = array.getOrNull(1) y == null || y > 2020 || y == 2020 && (m == null || m >= 3) } val safeModeConfigurable get() = Build.VERSION.SDK_INT >= 29 && hasP2pValidateName