mirror of
https://codeberg.org/PGPainless/wkd-java.git
synced 2024-11-25 16:52:07 +01:00
Catch NPE when fetching non-certificate data
This commit is contained in:
parent
2857273580
commit
30e8a55ef6
1 changed files with 3 additions and 0 deletions
|
@ -56,6 +56,9 @@ public class Fetch implements Runnable {
|
||||||
WKDAddress address = WKDAddress.fromEmail(email);
|
WKDAddress address = WKDAddress.fromEmail(email);
|
||||||
try (InputStream inputStream = fetcher.fetch(address)) {
|
try (InputStream inputStream = fetcher.fetch(address)) {
|
||||||
PGPPublicKeyRing cert = PGPainless.readKeyRing().publicKeyRing(inputStream);
|
PGPPublicKeyRing cert = PGPainless.readKeyRing().publicKeyRing(inputStream);
|
||||||
|
if (cert == null) {
|
||||||
|
throw new CertNotFetchableException("Fetched data does not contain an OpenPGP certificate.");
|
||||||
|
}
|
||||||
KeyRingInfo info = PGPainless.inspectKeyRing(cert);
|
KeyRingInfo info = PGPainless.inspectKeyRing(cert);
|
||||||
|
|
||||||
List<String> userIds = info.getValidAndExpiredUserIds();
|
List<String> userIds = info.getValidAndExpiredUserIds();
|
||||||
|
|
Loading…
Reference in a new issue