From: Matthias Sohn Date: Thu, 29 Dec 2016 00:09:03 +0000 (+0100) Subject: [findBugs] Fix potential NPE in CleanFilter X-Git-Tag: v4.7.0.201704051617-r~136 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f211bfc8411cd57e6591cbacab21e004a14553dd;p=jgit.git [findBugs] Fix potential NPE in CleanFilter Change-Id: Ibc20e9fc16be62f61748b3f59f6d70c1ebf63671 Signed-off-by: Matthias Sohn --- diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java index 66feca7518..c4e34eed0a 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java @@ -151,7 +151,10 @@ public class CleanFilter extends FilterCommand { FileUtils.delete(tmpFile.toFile()); } } else { - FileUtils.mkdirs(mediaFile.getParent().toFile(), true); + Path parent = mediaFile.getParent(); + if (parent != null) { + FileUtils.mkdirs(parent.toFile(), true); + } FileUtils.rename(tmpFile.toFile(), mediaFile.toFile(), StandardCopyOption.ATOMIC_MOVE); }