Items not being added to inventory (Solved)

why you add +1 to the array last index? it’s an array and last index +1 is not valid i guess.
what’s the logic in add a value to an array length instead of taking(substract) 1 from it ?