SpriteBatch.end() generating null pointer exception

Posted by odaymichael on Game Development See other posts from Game Development or by odaymichael
Published on 2013-10-19T03:51:01Z Indexed on 2013/10/19 4:14 UTC
Read the original article Hit count: 401

Filed under:
|
|

I am getting a null pointer exception using libGDX that the debugger points as the SpriteBatch.end() line. I was wondering what would cause this.

Here is the offending code block, specifically the batch.end() line:

    batch.begin();

    for (int j = 0; j < 3; j++)
        for (int i = 0; i < 3; i++)
            if (zoomgrid[i][j].getPiece().getImage() != null)
                zoomgrid[i][j].getPiece().getImage().draw(batch);

    batch.end();

The top of the stack is actually a line that calls

lastTexture.bind();

In the flush() method of com.badlogic.gdx.graphics.g2d.SpriteBatch.

I appreciate any input, let me know if I haven't included enough information.

© Game Development or respective owner

Related posts about opengl

Related posts about java