You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fix NPE in network capability validation code
#Summary Remove useless network capability validated code The crash was caused by failing to check for null in responses from calls to some system methods. In general this code doesn't help much since this specific check was added prior to adding the more thorough HEAD request to example.com. By removing it, it should fix the null issue, and in-fact make the naive internet check more in-line with what's expected which is a very simple network check. This naive check always followed by attempting to connect to example.com which provides a far more guaranteed check into whether the internet is in-fact connected. #Test Plan Connected bluetooth headset Launched app launched game Disconnected bluetooth Verified no crash #ROBOMERGE-SOURCE: CL 10155147 via CL 10155334 via CL 10155443 #ROBOMERGE-BOT: (v587-10111126) [CL 10155612 by ben temple in Main branch]
This commit is contained in:
@@ -258,16 +258,9 @@ public final class NetworkChangedManager implements NetworkConnectivityClient {
|
||||
if (networks.isEmpty() || connectivityManager == null) {
|
||||
return ConnectivityState.NO_CONNECTION;
|
||||
} else {
|
||||
NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
|
||||
boolean isConnected = (activeNetwork != null && activeNetwork.isAvailable() && activeNetwork.isConnected());
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (activeNetwork != null
|
||||
&& !connectivityManager.getNetworkCapabilities(connectivityManager.getActiveNetwork()).hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)) {
|
||||
isConnected = false;
|
||||
}
|
||||
}
|
||||
if (isConnected) {
|
||||
if (activeNetworkInfo != null && activeNetworkInfo.isAvailable() && activeNetworkInfo.isConnected()) {
|
||||
return ConnectivityState.CONNECTION_AVAILABLE;
|
||||
} else {
|
||||
return ConnectivityState.NO_CONNECTION;
|
||||
|
||||
Reference in New Issue
Block a user