]> source.dussan.org Git - jgit.git/commitdiff
[findBugs] Fix potential NPE in CleanFilter 85/87785/1
authorMatthias Sohn <matthias.sohn@sap.com>
Thu, 29 Dec 2016 00:09:03 +0000 (01:09 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Thu, 29 Dec 2016 00:09:03 +0000 (01:09 +0100)
Change-Id: Ibc20e9fc16be62f61748b3f59f6d70c1ebf63671
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java

index 66feca751867496635c17892eb961424924d5f80..c4e34eed0a2380fcd5fb920a6cf3273a0b334305 100644 (file)
@@ -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);
                                }