Permit p2pInterface to be null for whatever reasons

This commit is contained in:
Mygod
2018-04-27 17:38:14 -07:00
parent 04ddddeef0
commit 3b964e0537
2 changed files with 3 additions and 2 deletions

View File

@@ -41,7 +41,8 @@ enum class TetherType {
.map { it.toPattern() }
}
fun ofInterface(iface: String, p2pDev: String? = null) = when {
fun ofInterface(iface: String?, p2pDev: String? = null) = when {
iface == null -> NONE
iface == p2pDev -> WIFI_P2P
usbRegexes.any { it.matcher(iface).matches() } -> USB
wifiRegexes.any { it.matcher(iface).matches() } -> WIFI