From ba8f3cb1f22f745229ffdb765c9c23892c7300bb Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 Jul 2023 19:51:58 +0200 Subject: Fix errorprone warning about precedence The condition looks suspicious, as in case of (hasElement==null && hasNext()) the check will generate a NPE Change-Id: I267f9df6746393d72f5102bd5271441422550968 --- .../jgit/internal/transport/sshd/JGitPublicKeyAuthentication.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'org.eclipse.jgit.ssh.apache/src') diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyAuthentication.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyAuthentication.java index 9f1df89e33..eb55ec045b 100644 --- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyAuthentication.java +++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyAuthentication.java @@ -466,7 +466,7 @@ public class JGitPublicKeyAuthentication extends UserAuthPublicKey { @Override public KeyAgentIdentity next() { - if (hasElement == null && !hasNext() + if ((hasElement == null && !hasNext()) || !hasElement.booleanValue()) { throw new NoSuchElementException(); } -- cgit v1.2.3