Avoid a potential nil comparison error in next?