Fixed the index out of range with empty file names.