Check if there are any tags before looping through them.