Why does my function return two different values?

I want to spawn some pawns when the gamemode starts and attach them to random actors. I’ve had this working for a while but every now and again the pawns will attach to the same object, which breaks the game system. When looking into the issue I found that the function that logic is using is providing two different values, and I’m presuming this is the cause of the bug. I have no idea why this is happening though. There is nothing that I can think of that would cause this to happen. My first Print String occurs right at the end of the function, my second Print String is the next thing to be called. The Printed Strings are always in the correct order so I don’t think there is a race condition going on. My objects aren’t being updated at anytime during this process. Does UE4 handle Functions or Marcos in a strange way that might be causing this?

I have a solution to the problem which is to store the returned value as a variable inside the function, but I should have to do this… right? I’m more interested in knowing what might be going on because right now I don’t trust function return values and I don’t want to have to deal with a massive list of (what should be) redundant variables.

Could it be because the branch in your Update Platform Arrays function adds the Actor to Unoccupied Platform Array even though it is “Occupied” (see the true branch)?