summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-07-10 11:24:15 -0600
committerSean Leonard <meanderingcode@aetherislands.net>2013-07-11 10:39:53 -0600
commit7c2ec16d1ec98640dcc9e070f2b9361f68df6f02 (patch)
tree3d6d0254430cb47c3759e0632a2b6858e28aa8e3 /src
parent1f7d1334006e816c12f0d1915fcfdc697636dfec (diff)
Fix ConcurrentModificationException when removing VpnProfile from iterator backing Collection
Diffstat (limited to 'src')
-rw-r--r--src/se/leap/leapclient/EIP.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/se/leap/leapclient/EIP.java b/src/se/leap/leapclient/EIP.java
index 426f4359..b86a2a4a 100644
--- a/src/se/leap/leapclient/EIP.java
+++ b/src/se/leap/leapclient/EIP.java
@@ -302,7 +302,6 @@ public final class EIP extends IntentService {
ProfileManager vpl = ProfileManager.getInstance(context);
try {
-
if ( name == "first" ) {
name = vpl.getProfiles().iterator().next().mName;
}
@@ -330,9 +329,11 @@ public final class EIP extends IntentService {
// Currently deletes VpnProfile for host, if there already is one, and builds new
ProfileManager vpl = ProfileManager.getInstance(context);
Collection<VpnProfile> profiles = vpl.getProfiles();
- for (VpnProfile p : profiles){
+ for (Iterator<VpnProfile> it = profiles.iterator(); it.hasNext(); ){
+ VpnProfile p = it.next();
try {
if ( p.mName.contains( gateway.getString("host") ) )
+ it.remove();
vpl.removeProfile(context, p);
} catch (JSONException e) {
// TODO Auto-generated catch block