diff options
author | Scott Jackson <daneren2005@gmail.com> | 2016-06-23 17:49:03 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2016-06-23 17:49:03 -0700 |
commit | 49f80c4810e3388bbaba13d9382cd8c6971bdd75 (patch) | |
tree | ee8c1cffb8ccb9dc3693ef246043c97f59c0e2b5 | |
parent | 031417c0b9fec1e177ce8e8d2304a4c094e635f4 (diff) | |
download | dsub-49f80c4810e3388bbaba13d9382cd8c6971bdd75.tar.gz dsub-49f80c4810e3388bbaba13d9382cd8c6971bdd75.tar.bz2 dsub-49f80c4810e3388bbaba13d9382cd8c6971bdd75.zip |
Require SSID entry before using local network address
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/Util.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java index 417c3173..9f742ef0 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Util.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java @@ -412,13 +412,15 @@ public final class Util { String serverUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_URL + instance, null); if(allowAltAddress && Util.isWifiConnected(context)) { String SSID = prefs.getString(Constants.PREFERENCES_KEY_SERVER_LOCAL_NETWORK_SSID + instance, ""); - String currentSSID = Util.getSSID(context); - - String[] ssidParts = SSID.split(","); - if("".equals(SSID) || SSID.equals(currentSSID) || Arrays.asList(ssidParts).contains(currentSSID)) { - String internalUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_INTERNAL_URL + instance, null); - if(internalUrl != null && !"".equals(internalUrl) && !"http://".equals(internalUrl)) { - serverUrl = internalUrl; + if(!SSID.isEmpty()) { + String currentSSID = Util.getSSID(context); + + String[] ssidParts = SSID.split(","); + if ("".equals(SSID) || SSID.equals(currentSSID) || Arrays.asList(ssidParts).contains(currentSSID)) { + String internalUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_INTERNAL_URL + instance, null); + if (internalUrl != null && !"".equals(internalUrl) && !"http://".equals(internalUrl)) { + serverUrl = internalUrl; + } } } } |