Fix up FileDialog to cope with empty file lists and empty name entry box

For #2494.