Fix crash if an invalid path is given.