On Monday, October 3, 2011 8:38:42 PM UTC-4, bob wrote:
>
> I am getting a weird ACRA error:
>
> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
>
...
> at com.coolfone.sonicboom.Maingame.drawgamescreen(Maingame.java:508)
>
...
> Maingame.java:508 corresponds to "FallingEnemy f =
> fallingenemies.get(ctr);" here:
>
...
> // draw falling enemies
> for (int ctr = 0; ctr < fallingenemies.size(); ctr++) {
> FallingEnemy f = fallingenemies.get(ctr);
> gl.glPushMatrix();
> gl.glTranslatef(f.x, f.y, f.z);
> gl.glRotatef(-f.angle, 0, 0, 1);
> // gl.glScalef(.6f, .2f, 1);
> f.mesh.draw(gl);
> gl.glPopMatrix();
> }
>
>
> How is it possible for this line to generate an
> ArrayIndexOutOfBoundsException? I'm pretty sure no other thread is
> touching fallingenemies.
>
Given the stack trace and code quoted, the exception would be impossible.
for (int ctr = 0; ctr < fallingenemies.size(); ctr++) followed by a get of
index 0 wouldn't run. List.size() can't ever be -1. Something else is a
factor.
- C
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en