aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-07-28 17:04:25 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-07-28 17:09:56 +0200
commitda131220aac727865b9e33e8d34743939e8acbf0 (patch)
tree2ea9362119ff8bec0f832916c2f589b66c653cfd /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
parentcce243299a400e9d68b9bd350fd75870f51b732f (diff)
downloadopen-keychain-da131220aac727865b9e33e8d34743939e8acbf0.tar.gz
open-keychain-da131220aac727865b9e33e8d34743939e8acbf0.tar.bz2
open-keychain-da131220aac727865b9e33e8d34743939e8acbf0.zip
watch out for nullpointers from get(Un|)HashedSubpackets
fixes #721
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
index 69244ca14..6bce07824 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
@@ -413,7 +413,8 @@ public class PgpKeyOperation {
}
// if this is~ the/a primary user id
- if (currentCert.hasSubpackets() && currentCert.getHashedSubPackets().isPrimaryUserID()) {
+ if (currentCert.getHashedSubPackets() != null
+ && currentCert.getHashedSubPackets().isPrimaryUserID()) {
// if it's the one we want, just leave it as is
if (userId.equals(saveParcel.mChangePrimaryUserId)) {
ok = true;
@@ -740,7 +741,7 @@ public class PgpKeyOperation {
int flags = 0;
//noinspection unchecked
for(PGPSignature sig : new IterableIterator<PGPSignature>(key.getSignatures())) {
- if (!sig.hasSubpackets()) {
+ if (sig.getHashedSubPackets() == null) {
continue;
}
flags |= sig.getHashedSubPackets().getKeyFlags();