You don't need a comma if you end the sentence with a conditional clause. This is the second method. Ending with the conditional clause seems not to cause problems.
If I begin a sentence with if,
I'll put a comma after the end of the clause or phrase.