I'd say wrap this into the `if` statement check to avoid calling `.getFile()` twice