diff options
| author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-26 22:20:44 +0100 | 
|---|---|---|
| committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-26 22:20:44 +0100 | 
| commit | 5ce89c4af84ba4eec89bb62d723911d31388e4ff (patch) | |
| tree | a865af2a5bcc80036b67e07c58e0e8be28f47837 /OpenKeychain/src/main/java | |
| parent | 35c80ed429cbc4b4d920adf8161425efa09dece2 (diff) | |
| download | open-keychain-5ce89c4af84ba4eec89bb62d723911d31388e4ff.tar.gz open-keychain-5ce89c4af84ba4eec89bb62d723911d31388e4ff.tar.bz2 open-keychain-5ce89c4af84ba4eec89bb62d723911d31388e4ff.zip | |
fix consolidate if no secret key are present
Diffstat (limited to 'OpenKeychain/src/main/java')
| -rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index ce9a14a6f..b18b919c3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -950,11 +950,13 @@ public class ProviderHelper {                      KeyRings.PRIVKEY_DATA, KeyRings.FINGERPRINT, KeyRings.HAS_ANY_SECRET              }, KeyRings.HAS_ANY_SECRET + " = 1", null, null); -            if (cursor == null || !cursor.moveToFirst()) { +            if (cursor == null) {                  log.add(LogType.MSG_CON_ERROR_DB, indent);                  return new ConsolidateResult(ConsolidateResult.RESULT_ERROR, log);              } +            // No keys existing might be a legitimate option, we write an empty file in that case +            cursor.moveToFirst();              ParcelableFileCache<ParcelableKeyRing> cache =                      new ParcelableFileCache<ParcelableKeyRing>(mContext, "consolidate_secret.pcl");              cache.writeCache(cursor.getCount(), new Iterator<ParcelableKeyRing>() { @@ -1010,11 +1012,13 @@ public class ProviderHelper {                      KeyRings.PUBKEY_DATA, KeyRings.FINGERPRINT              }, null, null, null); -            if (cursor == null || !cursor.moveToFirst()) { +            if (cursor == null) {                  log.add(LogType.MSG_CON_ERROR_DB, indent);                  return new ConsolidateResult(ConsolidateResult.RESULT_ERROR, log);              } +            // No keys existing might be a legitimate option, we write an empty file in that case +            cursor.moveToFirst();              ParcelableFileCache<ParcelableKeyRing> cache =                      new ParcelableFileCache<ParcelableKeyRing>(mContext, "consolidate_public.pcl");              cache.writeCache(cursor.getCount(), new Iterator<ParcelableKeyRing>() { | 
