Modified getIndexStr method

Added a check for the type of the index expression. If it is an array type, code generator exits.