From ba8f3cb1f22f745229ffdb765c9c23892c7300bb Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 31 Jul 2023 19:51:58 +0200 Subject: [PATCH] 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 --- .../internal/transport/sshd/JGitPublicKeyAuthentication.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9f1df89e3..eb55ec045 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 boolean hasNext() { @Override public KeyAgentIdentity next() { - if (hasElement == null && !hasNext() + if ((hasElement == null && !hasNext()) || !hasElement.booleanValue()) { throw new NoSuchElementException(); }