omadec: Properly check lengths before incrementing the position