Don't call array_get with an out-of-range index

Even if it is actually safe in this situation.