[spotBugs] Fix potential NPE in SmudgeFilter#downloadLfsResource

Change-Id: Ibaf8481a5b1a96ebe1debfd98e1e2201d1005fc0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2018-09-13 00:54:58 +02:00
parent cdeecbd21f
commit 63fe317f60
1 changed files with 4 additions and 1 deletions

View File

@ -222,7 +222,10 @@ public static Collection<Path> downloadLfsResource(Lfs lfs, Repository db,
Integer.valueOf(responseCode)));
}
Path path = lfs.getMediaFile(ptr.getOid());
path.getParent().toFile().mkdirs();
Path parent = path.getParent();
if (parent != null) {
parent.toFile().mkdirs();
}
try (InputStream contentIn = contentServerConn
.getInputStream()) {
long bytesCopied = Files.copy(contentIn, path);