From 4eb16709cad0b01260b21dc6cc52d8121f844ba8 Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 17 Dec 2020 12:00:59 -0500 Subject: [PATCH] Refine code --- mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index e14e7315..21fed36f 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -57,9 +57,9 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene @delegate:TargetApi(29) private val hasP2pValidateName by lazy { - val array = Build.VERSION.SECURITY_PATCH.split('-', limit = 3).map { it.toIntOrNull() } - val y = array.getOrNull(0) - val m = array.getOrNull(1) + val array = Build.VERSION.SECURITY_PATCH.split('-', limit = 3) + val y = array.getOrNull(0)?.toIntOrNull() + val m = array.getOrNull(1)?.toIntOrNull() y == null || y > 2020 || y == 2020 && (m == null || m >= 3) } val safeModeConfigurable get() = Build.VERSION.SDK_INT >= 29 && hasP2pValidateName