diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/se/leap/bitmaskclient/EIP.java | 5 | ||||
| -rw-r--r-- | src/se/leap/openvpn/ConfigParser.java | 2 | 
2 files changed, 4 insertions, 3 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;  				} diff --git a/src/se/leap/openvpn/ConfigParser.java b/src/se/leap/openvpn/ConfigParser.java index 36585d29..df4eae1b 100644 --- a/src/se/leap/openvpn/ConfigParser.java +++ b/src/se/leap/openvpn/ConfigParser.java @@ -357,7 +357,7 @@ public class ConfigParser {  		}  		// Parse remote config -		Vector<String> location = getOption("location",1,2); +		Vector<String> location = getOption("location",0,2);  		if(location != null && location.size() == 2){  			np.mLocation = location.get(1).replace("__", ", ");  		}  | 
