Consider the following phrase:
If the fruit is an apple, it should be given to children.
Is the comma after apple necessary? Is it optional? Is it wrong?
In that case, the comma is optional. According to the Wikipedia page on Comma:
The two paragraphs that I extracted from the article apply to your sentence. It's a short sentence with a dependent clause (if the item is an apple) and an independent clause (it should be given to children), where the dependent clause comes first.