Avoid an infinite loop in the case where no solution exists.