diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-11-15 20:54:29 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-11-15 23:25:39 +0100 |
commit | b5b197a9c4edde87cc36d61b13058c58520bafb0 (patch) | |
tree | 695a12153fa261ea7d062351f4c0b798468021ed /OpenKeychain/src/main/java/org/sufficientlysecure/keychain | |
parent | c4599798f9807c0cc692e1b08355892136ab317c (diff) | |
download | open-keychain-b5b197a9c4edde87cc36d61b13058c58520bafb0.tar.gz open-keychain-b5b197a9c4edde87cc36d61b13058c58520bafb0.tar.bz2 open-keychain-b5b197a9c4edde87cc36d61b13058c58520bafb0.zip |
decryptlist: fix iterators
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java index 000de6e40..8adaa0670 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import android.Manifest; @@ -676,11 +677,13 @@ public class DecryptListFragment if (permissionWasGranted) { // permission granted -> retry all cancelled file uris - for (Uri uri : mCancelledInputUris) { + Iterator<Uri> it = mCancelledInputUris.iterator(); + while (it.hasNext()) { + Uri uri = it.next(); if ( ! "file".equals(uri.getScheme())) { continue; } - mCancelledInputUris.remove(uri); + it.remove(); mPendingInputUris.add(uri); mAdapter.setCancelled(uri, false); } @@ -688,12 +691,17 @@ public class DecryptListFragment } else { // permission denied -> cancel current, and all pending file uris + mCancelledInputUris.add(mCurrentInputUri); + mAdapter.setCancelled(mCurrentInputUri, true); + mCurrentInputUri = null; - for (final Uri uri : mPendingInputUris) { + Iterator<Uri> it = mPendingInputUris.iterator(); + while (it.hasNext()) { + Uri uri = it.next(); if ( ! "file".equals(uri.getScheme())) { continue; } - mPendingInputUris.remove(uri); + it.remove(); mCancelledInputUris.add(uri); mAdapter.setCancelled(uri, true); } |