Add an assert and use a range loop. NFC.