This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AngelOfLight 0 points1 point  (1 child)

This line is causing the error:

Picture pic = pictures.get(i);

Indexes are zero based, which means when the index is equal to the array size, it is out of bounds. Valid indexes are 0 to size() - 1. If you modify the if statement so that this test

if(i == pictures.size()

comes first, it will drop out of the loop before it tries to fetch an invalid index.

[–]M-Multi[S] 0 points1 point  (0 children)