A more robust if statement