The null-checker wasn't clever enough to understand the while-loop was safe so I switched it to a for. PiperOrigin-RevId: 275440464