Commit f052fe97 authored by Max Lv's avatar Max Lv

Fix a crash on Huawei device

parent 0ae469de
...@@ -392,7 +392,12 @@ object BaseService { ...@@ -392,7 +392,12 @@ object BaseService {
// it's hard to resolve DNS on a specific interface so we'll do it here // it's hard to resolve DNS on a specific interface so we'll do it here
if (!profile.host.isNumericAddress()) { if (!profile.host.isNumericAddress()) {
thread("BaseService-resolve") { thread("BaseService-resolve") {
profile.host = InetAddress.getByName(profile.host).hostAddress ?: "" // A WAR fix for Huawei devices that UnknownHostException cannot be caught correctly
try {
profile.host = InetAddress.getByName(profile.host).hostAddress ?: ""
} catch (_: UnknownHostException) {
profile.host = "";
}
}.join(10 * 1000) }.join(10 * 1000)
if (!profile.host.isNumericAddress()) throw UnknownHostException() if (!profile.host.isNumericAddress()) throw UnknownHostException()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment