From 9cdb2ec4e270a572520d5bcdbee55867e3c37003 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 20 Apr 2014 20:50:24 +0200 Subject: fix nullpointer on missing s2k Fixes #590 --- .../java/org/sufficientlysecure/keychain/provider/ProviderHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenKeychain/src/main/java/org') 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 099ed8c1f..214a9988c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -404,8 +404,9 @@ public class ProviderHelper { values.put(Keys.HAS_SECRET, 1); // then, mark exactly the keys we have available for (PGPSecretKey sub : new IterableIterator(keyRing.getSecretKeys())) { + S2K s2k = sub.getS2K(); // Set to 1, except if the encryption type is GNU_DUMMY_S2K - if(sub.getS2K().getType() != S2K.GNU_DUMMY_S2K) { + if(s2k == null || s2k.getType() != S2K.GNU_DUMMY_S2K) { mContentResolver.update(uri, values, Keys.KEY_ID + " = ?", new String[]{ Long.toString(sub.getKeyID()) }); -- cgit v1.2.3