Fix infinite loop on empty index files