Attempted to access index -1 from array despite validation

This feels a bit weird:

Maybe “technically correct” but why not add that little bit of functionality to the Is Valid node?

I think there’s something wrong with your test…

None of this code is accessing index -1, I’m guessing you’re doing that elsewhere?

The Get node is evaluated multiple times. And with it the Last Index. So if you change the array between evaluations you may end up accessing indices that are suddenly no longer valid. Last Index returns -1 if the array is empty.

Yes it is because:

And I still think the part in the red comment should work for that case, but it doesn’t!

1 Like

It’s because you’re doing more stuff over to the right… :slight_smile:

Not sure what it takes to convince you that that’s not the case…

EDIT: I guess this is how Epic meant it to be done…

And that works?

Yes, because the script warning which made me create this thread doesn’t happen at the Is Valid node… it already happens at the Get node like @UnrealEverything said.

But I still stand by this, from a UX perspective (and Blueprints should be all about the UX, imo):

Guess I can always add that UX myself… :laughing:

image