mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 22:32:07 +01:00
Fix NPE when validating broken signature
This commit is contained in:
parent
f1f7dec8b6
commit
3fe78ab12a
1 changed files with 4 additions and 0 deletions
|
@ -575,6 +575,10 @@ public final class SignatureSubpacketsUtil {
|
|||
* @return last occurrence of the subpacket in the vector
|
||||
*/
|
||||
public static <P extends org.bouncycastle.bcpg.SignatureSubpacket> P getSignatureSubpacket(PGPSignatureSubpacketVector vector, SignatureSubpacket type) {
|
||||
if (vector == null) {
|
||||
// Almost never happens, but may be caused by broken signatures.
|
||||
return null;
|
||||
}
|
||||
org.bouncycastle.bcpg.SignatureSubpacket[] allPackets = vector.getSubpackets(type.getCode());
|
||||
if (allPackets.length == 0) {
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue