Extremely Strange Array Bug

I’m running into an extremely strange bug that I’ve no idea where to begin remotely approaching the solution.

The setup is simple. The function checks if an array contains a certain item
and then loops through the item to find where is it in.

Now here’s where it went wrong:

  1. How could it passed the ‘Contain’ condition and YET could not find the item in the loop
  2. On checking, how did it pass the contain condition when the array is empty ?
  3. I’ve a loop outside of this function. On the next iteration how did it passed the contain condition AGAIN despite the array being empty.

4957179d1032ab9f5754ee3045398ea22d03e1f5.jpeg

The target of the variable isn’t being destroyed or garbage collected between the branch and the loop is it? Maybe instead of == use IsValid?

I actually need to check if the item is same as self.

I’ve have so many different setups I lost count. One of the setups had the ‘self’ returning null. Which is the weirdest thing so far. I then circumvent this by dumping the self and pass in via actor.

Eventually I found the most critical part which is during the ForEachLoop the element is returning ‘empty’ . Although manually getting the Element Via index returns correctly.
This is getting weirder by the minute.

Hello,

In your loop, the exec wire continues after your set “temp int” which means that this line is not finished to execute : maybe what is done after (which is done before the completed and done on each index) is the trouble. Especially if you link to the same point than the other exits (false branch and print string output)

Only an add idea : You may be can simplify by using a “find” / is valid / “get” from find output. (but it will select the first index in the array, not sure if this ok for your situation, you’ll need to change the append text.)

If not, you can use loop with break instead of loop to link break after your set “temp int” and use completed when done instead of doing all the array.

in hope it helps.