Added code to fix null pointer exception when list of files is empty