Trying to Access Value Outside Array Length

I have a few arrays that are being read and set, during this process sometimes (at random) the array will return an error saying that it can’t access value at length ‘x’ but that value would be outside of set length. Nothing in all the blueprints would change the length of these arrays.
I can’t seem to find anything related to this issue, anyone have any ideas?

length is number of elements in array, array do preallocate memory to avoid reallocation when you add elements to it but it does not count to it’s length. Heres few things you can review:

-Make sure you not accessing empty array

-Array may feel filled to you but at moment of call they may not and it can be momentary, so check code flow if array is reed after elements are added

-If you use length to generate index to read array make sure you -1, as if length is 1 the only element in it will have index 0

-Use “for each” node if you loop thru array and use element that it gives you instead of index

You use multiple arrays, which one raports error? You sure all index match in all arrays?

Thank you for your response,
I added a simple version of what I am doing below.

Some things to note,

  • All arrays are filled manually.
  • I never alter the length of any arrays.
  • And I never use the “Get Length” for anything.

I found a small fix by adding a Branch that checks the array index to make sure it hasn’t gone too far but I think it’s still effecting the data.

Yes they all have 14 values. In this case the DeltaAngle function returns the error.

Also remember there is a Last Index node so you dont have to go Length-1