Skip to content

Commit 8b65125

Browse files
Fix Android cert reason mapping
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 36f4965 commit 8b65125

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/native/libs/System.Security.Cryptography.Native.Android/pal_x509chain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ static void PopulateValidationError(JNIEnv* env, jobject error, bool isRevocatio
308308
{
309309
index = (*env)->CallIntMethod(env, error, g_CertPathValidatorExceptionGetIndex);
310310

311-
// Get the reason (if the API is available) and convert it to a chain status flag
312-
if (g_CertPathValidatorExceptionGetReason != NULL)
311+
// Get the reason and convert it to a chain status flag.
312+
jobject reason = (*env)->CallObjectMethod(env, error, g_CertPathValidatorExceptionGetReason);
313+
if (!CheckJNIExceptions(env) && reason != NULL)
313314
{
314-
jobject reason = (*env)->CallObjectMethod(env, error, g_CertPathValidatorExceptionGetReason);
315315
chainStatus = ChainStatusFromValidatorExceptionReason(env, reason);
316316
(*env)->DeleteLocalRef(env, reason);
317317
}

0 commit comments

Comments
 (0)