Fix crash when attempting to open an empty file