From 48b772bec1b65da04072b4239119da759547865f Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 29 Dec 2016 00:37:59 +0100 Subject: [PATCH] [findBugs] Fix potential NPE in DirCacheCheckoutTest Change-Id: I842cbdd14bf56cb2bd599255fe90a5a3aea0d304 Signed-off-by: Matthias Sohn --- .../tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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++; -- 2.39.5