1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-27 18:30:09 +00:00

Fixed home wifi crash

This commit is contained in:
M66B 2015-12-14 08:21:33 +01:00
parent 846110c8c9
commit 69d943d78b
2 changed files with 3 additions and 2 deletions

View file

@ -123,7 +123,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
List<WifiConfiguration> configs = wm.getConfiguredNetworks(); List<WifiConfiguration> configs = wm.getConfiguredNetworks();
if (configs != null) if (configs != null)
for (WifiConfiguration config : configs) for (WifiConfiguration config : configs)
listSSID.add(config.SSID); listSSID.add(config.SSID == null ? "NULL" : config.SSID);
pref_wifi_homes.setEntries(listSSID.toArray(new CharSequence[0])); pref_wifi_homes.setEntries(listSSID.toArray(new CharSequence[0]));
pref_wifi_homes.setEntryValues(listSSID.toArray(new CharSequence[0])); pref_wifi_homes.setEntryValues(listSSID.toArray(new CharSequence[0]));

View file

@ -111,7 +111,8 @@ public class Util {
public static String getWifiSSID(Context context) { public static String getWifiSSID(Context context) {
WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
return wm.getConnectionInfo().getSSID(); String ssid = wm.getConnectionInfo().getSSID();
return (ssid == null ? "NULL" : ssid);
} }
public static int getNetworkType(Context context) { public static int getNetworkType(Context context) {