From d8a6ba43ae2989bfffaa54fddf2678f4ded9cf90 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 9 Mar 2019 00:58:08 -0500 Subject: [PATCH] Fix support for unrecognized psk line --- .../net/wifi/P2pSupplicantConfiguration.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt index e649ddb8..e5ca3f00 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt @@ -64,14 +64,14 @@ class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress: block.ssidLine = block.size } else if (parser.trimmed.startsWith("mode=3")) block.groupOwner = true else { val match = networkParser.find(parser.trimmed) - if (match != null) if (match.groups[4] != null) { - check(block.pskLine == null && block.psk == null) - if (match.groups[5] != null) { - block.psk = match.groupValues[5].apply { check(length in 8..63) } - } - block.pskLine = block.size - } else if (match.groups[2] != null && match.groupValues[2].equals(bssid, true)) { - block.bssidMatches = true + if (match != null) match.groupValues[2].also { matchedBssid -> + if (matchedBssid.isEmpty()) { + check(block.pskLine == null && block.psk == null) + if (match.groups[5] != null) { + block.psk = match.groupValues[5].apply { check(length in 8..63) } + } + block.pskLine = block.size + } else if (matchedBssid.equals(bssid, true)) block.bssidMatches = true } } block.add(parser.line)