diff options
author | cyBerta <richy@cyborgsociety.org> | 2014-03-18 12:18:23 +0100 |
---|---|---|
committer | cyBerta <richy@cyborgsociety.org> | 2014-03-18 12:18:23 +0100 |
commit | bb503590fc648e6b97f0f2b95156d4179cc33a11 (patch) | |
tree | bcbf8d58eec1eb3b0a6de486a1a88c553ee0c17f /src/se/leap/bitmaskclient | |
parent | 608653a64648fd6d7e37987ee4a160a3dd68f775 (diff) | |
parent | 1df967637d432bccc405f0a2e7ce46dc236cffff (diff) |
Merge branch 'bug/connection-to-calyx.net-fails-and-app-crashes-#4550' into develop
Diffstat (limited to 'src/se/leap/bitmaskclient')
-rw-r--r-- | src/se/leap/bitmaskclient/EIP.java | 5 |
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; } |