From 4601e1023f42f1418991d5793436a1d7d887e07e Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 4 Dec 2022 16:33:32 -0500 Subject: [PATCH] Skip setting persistent randomized mac if null --- .../mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt index be13dd4d..20bbff22 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt @@ -572,8 +572,10 @@ data class SoftApConfigurationCompat( setIeee80211beEnabled(builder, isIeee80211beEnabled) setBridgedModeOpportunisticShutdownTimeoutMillis(builder, bridgedModeOpportunisticShutdownTimeoutMillis) setVendorElements(builder, vendorElements) - if (sac?.let { getPersistentRandomizedMacAddress(it) as MacAddress } != - persistentRandomizedMacAddress) try { + val needsUpdate = persistentRandomizedMacAddress != null && sac?.let { + getPersistentRandomizedMacAddress(it) as MacAddress + } != persistentRandomizedMacAddress + if (needsUpdate) try { setRandomizedMacAddress(builder, persistentRandomizedMacAddress) } catch (e: ReflectiveOperationException) { Timber.w(e)