This error seems to suggest you are trying to call a too high index number for your string.
Are you looping over a string somewhere? Remember that arrays start at 0, so you need to start your loop counter at 0 when using > or <, otherwise you end up trying to check for string[string.length+1] which would give this error.