diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/LsUserRefs.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/LsUserRefs.java index 18067495aa..b0ed650375 100644 --- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/LsUserRefs.java +++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/LsUserRefs.java @@ -109,7 +109,9 @@ public class LsUserRefs extends SshCommand { throw new UnloggedFailure("fatal: Error opening: '" + projectControl.getProject().getNameKey()); } finally { - repo.close(); + if (repo != null) { + repo.close(); + } } } }