guard a call to file-name-nondirectory

that function will throw an error if passed a nil argument