From b833d94002be8066a1f8abb84ff196184701e578 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 23 May 2020 09:04:58 +0800 Subject: [PATCH] Refine error message --- mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt index 1f9d31c2..ac36b12e 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt @@ -118,7 +118,7 @@ class Routing(private val caller: Any, private val downstream: String, } private val hostAddress = try { - val iface = NetworkInterface.getByName(downstream)!! + val iface = NetworkInterface.getByName(downstream) ?: error("iface not found") ifaceHandler(iface) val addresses = iface.interfaceAddresses!!.filter { it.address is Inet4Address } if (addresses.size > 1) error("More than one addresses was found: $addresses")