Custom property binding with null subscript value fetches first value of referenced array

I am unsure if this is intended behavior or not. Ignition version 8.1.25

I have an expression binding on a custom property in perspective that is along the lines of
{session.custom.array1}[{session.custom.selection1}] .

I set selection1 to null when initializing but also when a different selection field is modified. selection1 is a selection index, so I use null since setting to a negative number would result in it grabbing something else from the array.

When populating array1 after changing selections elsewhere, and not changing the value in selection1 from null, the custom property with the above binding has the data from the first item of array1.

I then tested directly with a binding of {session.custom.array1}[null] and it returned the data from the first item in array1

Array and bound properties

tmp1

Sounds like null is being coerced to zero. Not sure what it should be.

In python, yes someList[-1] would indeed retrieve the last item in the list. Not so in the expression language. The expression language does not allow negative indexes. You would get and Error_ExpressionEval: Error performing subscript operation. Maybe that's acceptable maybe not.

Not sure what it should be, but you can probably come up with some combination of expressions to return an acceptable value.

That's what it seems like. Caught me off guard because I figured it would return null.

I've thrown in a isNull check before the subscript operation, and have it return a blank value if so. I just wasn't sure if this was intended behavior or what.