prevent NPE in test

This commit is contained in:
Milos Kozak 2019-07-28 13:26:15 +02:00
parent 53b9d97f5d
commit 68d9a5af70

View file

@ -111,12 +111,14 @@ public class SignatureVerifier extends PluginBase implements ConstraintsInterfac
synchronized ($lock) { synchronized ($lock) {
if (revokedCerts == null) return false; if (revokedCerts == null) return false;
Signature[] signatures = MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), PackageManager.GET_SIGNATURES).signatures; Signature[] signatures = MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), PackageManager.GET_SIGNATURES).signatures;
for (Signature signature : signatures) { if (signatures != null) {
MessageDigest digest = MessageDigest.getInstance("SHA256"); for (Signature signature : signatures) {
byte[] fingerprint = digest.digest(signature.toByteArray()); MessageDigest digest = MessageDigest.getInstance("SHA256");
for (byte[] cert : revokedCerts) { byte[] fingerprint = digest.digest(signature.toByteArray());
if (Arrays.equals(cert, fingerprint)) { for (byte[] cert : revokedCerts) {
return true; if (Arrays.equals(cert, fingerprint)) {
return true;
}
} }
} }
} }