diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index 5e7eb0a4a..40a0b72ce 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -432,7 +432,7 @@ public class PgpKeyOperation { // TODO: this only takes care of user id certificates, what about others? PGPPublicKey pubkey = publicKeyRing.getPublicKey(); for(String uid : new IterableIterator(pubkey.getUserIDs())) { - for(PGPSignature sig : new IterableIterator(oldPublicKey.getSignaturesForID(uid))) { + for(PGPSignature sig : new IterableIterator(oldPublicKey.getSignaturesForID(uid), true)) { // but skip self certificates if(sig.getKeyID() == pubkey.getKeyID()) continue; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java index caaa07524..40105df4f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java @@ -16,13 +16,21 @@ package org.sufficientlysecure.keychain.util; +import java.util.ArrayList; import java.util.Iterator; public class IterableIterator implements Iterable { private Iterator mIter; - public IterableIterator(Iterator iter) { + public IterableIterator(Iterator iter, boolean failsafe) { mIter = iter; + if(failsafe && mIter == null) { + // is there a better way? + mIter = new ArrayList().iterator(); + } + } + public IterableIterator(Iterator iter) { + this(iter, false); } public Iterator iterator() {