Check for valid index before accessing data
p4#: 21957