WifiStateChangeService: handle BSSID when WifiConfiguration is null

fixes:

java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.net.wifi.WifiConfiguration.BSSID' on a null object reference
 at org.fdroid.fdroid.nearby.WifiStateChangeService.setSsid(WifiStateChangeService.java:265)
 at org.fdroid.fdroid.nearby.WifiStateChangeService.access$100(WifiStateChangeService.java:59)
 at org.fdroid.fdroid.nearby.WifiStateChangeService$WifiInfoThread.run(WifiStateChangeService.java:174)
This commit is contained in:
Hans-Christoph Steiner 2019-07-26 18:15:34 +02:00
parent 915aeb6c54
commit d233b03029
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA

View File

@ -257,7 +257,11 @@ public class WifiStateChangeService extends IntentService {
Utils.debugLog(TAG, "WifiConfiguration: " + wifiConfiguration);
if (wifiConfiguration == null) {
FDroidApp.ssid = getString(R.string.swap_active_hotspot, "");
} else if (wifiConfiguration.hiddenSSID) {
FDroidApp.bssid = "";
return;
}
if (wifiConfiguration.hiddenSSID) {
FDroidApp.ssid = getString(R.string.swap_hidden_wifi_ssid);
} else {
FDroidApp.ssid = wifiConfiguration.SSID;