InputField.text = "string" index argument out of range

I have an input field and I can set the text to an empty string without a problem but when I try to set it to any other kind of string, for example “and”, I get:

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index

The text shows up correctly as “and” but then it just goes nuts with about 7 of these.

Is it not possible to set the text of an input field?

Yes, it is in a loop, but the arguments don’t come as part of the loop…

InputField[] ipf = gameObject.GetComponentsInChildren<InputField>();
string[] journals = <data we got from the database>;

int idx = 0;
for(int i = 0; i < journals.Count; i++)
    if( journals *== "")*


Debug.Log(“This prints out correctly”);
ipf[idx++].text = journals*;*
Debug.Log(“This line never prints out, but we get 7 argument index out of range errors instead”);