From: Matthias Sohn Date: Wed, 28 Dec 2016 23:37:59 +0000 (+0100) Subject: [findBugs] Fix potential NPE in DirCacheCheckoutTest X-Git-Tag: v4.7.0.201704051617-r~140 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=48b772bec1b65da04072b4239119da759547865f;p=jgit.git [findBugs] Fix potential NPE in DirCacheCheckoutTest Change-Id: I842cbdd14bf56cb2bd599255fe90a5a3aea0d304 Signed-off-by: Matthias Sohn --- diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java index bb553a444e..388456f949 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java @@ -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++;