Fix NPE caused by empty directory

If the file is a directory and it is already empty, the list of files
will be null. Check for null in this case and don't attempt to delete
anything and instead only add it to the list of emptyDirs.