On second thoughts: you can't check for empty filename, since it's set to the non existent file. But you can use a boolean in this cycle to establish that the file does exist, and use it later.