relooked at the code and there is no need for the if, the file simply won't be saved if the path was null.