diff --git a/app/src/main/java/eu/faircode/netguard/ActivitySettings.java b/app/src/main/java/eu/faircode/netguard/ActivitySettings.java index 4c4a6421..f43cc198 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivitySettings.java +++ b/app/src/main/java/eu/faircode/netguard/ActivitySettings.java @@ -123,7 +123,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere List configs = wm.getConfiguredNetworks(); if (configs != null) 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.setEntryValues(listSSID.toArray(new CharSequence[0])); diff --git a/app/src/main/java/eu/faircode/netguard/Util.java b/app/src/main/java/eu/faircode/netguard/Util.java index ff679ea2..aa6eba57 100644 --- a/app/src/main/java/eu/faircode/netguard/Util.java +++ b/app/src/main/java/eu/faircode/netguard/Util.java @@ -111,7 +111,8 @@ public class Util { public static String getWifiSSID(Context context) { 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) {