From 69d943d78b47391143cb5f148e0225ace5321ace Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 14 Dec 2015 08:21:33 +0100 Subject: [PATCH] Fixed home wifi crash --- app/src/main/java/eu/faircode/netguard/ActivitySettings.java | 2 +- app/src/main/java/eu/faircode/netguard/Util.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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) {