summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient/EIP.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-03-11 19:48:22 +0100
committerParménides GV <parmegv@sdf.org>2014-03-11 19:48:22 +0100
commit1df967637d432bccc405f0a2e7ce46dc236cffff (patch)
tree329ec9f4641e42a51272f2adcc13bc70dfccfe33 /src/se/leap/bitmaskclient/EIP.java
parent87826ce5c276489d74b37618b9d534b32e446eca (diff)
Locations in eip-service can be empty.
Diffstat (limited to 'src/se/leap/bitmaskclient/EIP.java')
-rw-r--r--src/se/leap/bitmaskclient/EIP.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/se/leap/bitmaskclient/EIP.java b/src/se/leap/bitmaskclient/EIP.java
index b3b2c95d..e773e3b9 100644
--- a/src/se/leap/bitmaskclient/EIP.java
+++ b/src/se/leap/bitmaskclient/EIP.java
@@ -332,14 +332,15 @@ public final class EIP extends IntentService {
}
}
- String closestLocation = offsets.firstEntry().getValue().iterator().next();
+
+ String closestLocation = offsets.isEmpty() ? "" : offsets.firstEntry().getValue().iterator().next();
JSONArray gateways = null;
String chosenHost = null;
try {
gateways = eipDefinition.getJSONArray("gateways");
for (int i = 0; i < gateways.length(); i++) {
JSONObject gw = gateways.getJSONObject(i);
- if ( gw.getString("location").equalsIgnoreCase(closestLocation) ){
+ if ( gw.getString("location").equalsIgnoreCase(closestLocation) || closestLocation.isEmpty()){
chosenHost = gw.getString("host");
break;
}