Skip to content

Commit

Permalink
fix: NPE in registerNetworkCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Sep 22, 2023
1 parent 4f8529e commit 3d16988
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ object ProxyUtil {
val networkCallback: ConnectivityManager.NetworkCallback =
object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
val networkCapabilities = connectivityManager.getNetworkCapabilities(network)
val vpn = networkCapabilities!!.hasTransport(NetworkCapabilities.TRANSPORT_VPN)
val networkCapabilities =
connectivityManager.getNetworkCapabilities(network) ?: return
val vpn = networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)
if (!vpn) {
if (SharedConfig.currentProxy == null) {
if (!SharedConfig.proxyList.isEmpty()) {
Expand Down

0 comments on commit 3d16988

Please sign in to comment.