Fix NullPointerException when File#listFiles() returns null

See issue 1934 where the NPE is listed in a few comments. The problem is
that File#listFiles() can return null, see documentation:

http://docs.oracle.com/javase/7/docs/api/java/io/File.html#listFiles%28%29

This fixes all the listFiles call sites that aren't part of an assertion
in a test case.