]> source.dussan.org Git - jgit.git/commitdiff
[findBugs] Fix potential NPE in DirCacheCheckoutTest 81/87781/1
authorMatthias Sohn <matthias.sohn@sap.com>
Wed, 28 Dec 2016 23:37:59 +0000 (00:37 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 28 Dec 2016 23:59:31 +0000 (00:59 +0100)
Change-Id: I842cbdd14bf56cb2bd599255fe90a5a3aea0d304
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java

index bb553a444e50db79fb97f4089112e10770336243..388456f949e4594263863a2eee006b89efc73f87 100644 (file)
@@ -1705,7 +1705,8 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
                                                        + " in workDir. ", buffer, i.get(path).getBytes());
                                        nrFiles++;
                                } else if (file.isDirectory()) {
-                                       if (file.list().length == 0) {
+                                       String[] files = file.list();
+                                       if (files != null && files.length == 0) {
                                                assertEquals("found unexpected empty folder for path "
                                                                + path + " in workDir. ", "/", i.get(path));
                                                nrFiles++;