IndexOutOfBoundsException: index: 0 size: 0
in
Programming Questions
•
1 year ago
I'm getting this error occasionally and it points me to two different areas of the same piece of code each time..
- for (int i = bullet.size() - 1; i >= 0; i--) {
- boolean remove = false;
- bullet.get(i).run();
- for (int j = enemy.size() - 1; j >= 0; j--) {
- if (enemy.get(j).pointInside(bullet.get(i).x, bullet.get(i).y)) {
- bullet.remove(i);
- enemy.remove(j);
- score += 100;
- }
- }
- if (bullet.get(i).y <= 0) {
- bullet.remove(i);
- }
- }
Can anyone point me in the right direction please? =]
1