This assert would never fail, because each element of the list is a valid string. You should check whether `LogFileNames` is empty before entering the loop.