posted 4 years ago
The problem is due to when a line is read from the stream and subsequently split into an array. Your code does not check how many elements are in the array. You simply access each element after the split. You need to run your code in debug to find out why the array does not contain the number of elements you are expecting it to.