Test the index before accessing an array in the condition test for a for loop in uadestate.c.