diff --git a/privacystreams-core/src/main/java/com/github/privacystreams/utils/ConnectionUtils.java b/privacystreams-core/src/main/java/com/github/privacystreams/utils/ConnectionUtils.java index f1082ec3..b83d4218 100644 --- a/privacystreams-core/src/main/java/com/github/privacystreams/utils/ConnectionUtils.java +++ b/privacystreams-core/src/main/java/com/github/privacystreams/utils/ConnectionUtils.java @@ -27,8 +27,7 @@ public static boolean isWifiConnected(UQI uqi) { WifiManager wifiManager = (WifiManager) uqi.getContext().getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager == null || !wifiManager.isWifiEnabled()) return false; WifiInfo wifiInfo = wifiManager.getConnectionInfo(); - if (wifiInfo == null || wifiInfo.getNetworkId() == -1) return false; - return wifiInfo.getSupplicantState() == SupplicantState.ASSOCIATED; + return !(wifiInfo == null || wifiInfo.getNetworkId() == -1) && wifiInfo.getSupplicantState() == SupplicantState.ASSOCIATED; } /* Checks whether the device currently has a network connection.