Catch SocketException
This commit is contained in:
@@ -22,6 +22,7 @@ import java.io.File
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
import java.net.NetworkInterface
|
import java.net.NetworkInterface
|
||||||
|
import java.net.SocketException
|
||||||
|
|
||||||
class SettingsPreferenceFragment : PreferenceFragmentCompatDividers() {
|
class SettingsPreferenceFragment : PreferenceFragmentCompatDividers() {
|
||||||
private val customTabsIntent by lazy {
|
private val customTabsIntent by lazy {
|
||||||
@@ -103,9 +104,14 @@ class SettingsPreferenceFragment : PreferenceFragmentCompatDividers() {
|
|||||||
UpstreamMonitor.KEY -> displayPreferenceDialog(
|
UpstreamMonitor.KEY -> displayPreferenceDialog(
|
||||||
AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat(), UpstreamMonitor.KEY,
|
AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat(), UpstreamMonitor.KEY,
|
||||||
Bundle().put(AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat.KEY_SUGGESTIONS,
|
Bundle().put(AlwaysAutoCompleteEditTextPreferenceDialogFragmentCompat.KEY_SUGGESTIONS,
|
||||||
NetworkInterface.getNetworkInterfaces().asSequence()
|
try {
|
||||||
.filter { it.isUp && !it.isLoopback && it.interfaceAddresses.isNotEmpty() }
|
NetworkInterface.getNetworkInterfaces().asSequence()
|
||||||
.map { it.name }.sorted().toList().toTypedArray()))
|
.filter { it.isUp && !it.isLoopback && it.interfaceAddresses.isNotEmpty() }
|
||||||
|
.map { it.name }.sorted().toList().toTypedArray()
|
||||||
|
} catch (e: SocketException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
emptyArray<String>()
|
||||||
|
}))
|
||||||
else -> super.onDisplayPreferenceDialog(preference)
|
else -> super.onDisplayPreferenceDialog(preference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user