Ensure home directory not null before using in Sshdsessionfactory

Home directory might not be set in DFS.

Change-Id: I3528685838065dc291826fc73a37126af7bf47ce
This commit is contained in:
Minh Thai 2023-09-06 07:13:05 -07:00
parent f90f0717a0
commit ba1653162c
1 changed files with 6 additions and 4 deletions

View File

@ -244,11 +244,13 @@ public SshdSession getSession(URIish uri,
JGitSshClient.PREFERRED_AUTHENTICATIONS,
defaultAuths);
}
try {
jgitClient.setAttribute(JGitSshClient.HOME_DIRECTORY,
home.getAbsoluteFile().toPath());
} catch (SecurityException | InvalidPathException e) {
if (home != null && home.getAbsoluteFile() != null) {
try {
jgitClient.setAttribute(JGitSshClient.HOME_DIRECTORY,
home.getAbsoluteFile().toPath());
} catch (SecurityException | InvalidPathException e) {
// Ignore
}
}
// Other things?
return client;