# HG changeset patch # User Matti Hamalainen # Date 1298512786 -7200 # Node ID caf67c7e081469461fbb29515bd0a4021e681013 # Parent ceaf645ed930c83b03424d3e4790a2a676d8282f Fix a possible null pointer exception under certain circumstances. diff -r ceaf645ed930 -r caf67c7e0814 game/Engine.java --- a/game/Engine.java Thu Feb 24 03:58:33 2011 +0200 +++ b/game/Engine.java Thu Feb 24 03:59:46 2011 +0200 @@ -494,10 +494,13 @@ if (!lauta.flagGameOver) { - // Draw next piece - AffineTransform save = g2.getTransform(); - lauta.nextPiece.paint(g2, 830, 325, 90); - g2.setTransform(save); + if (lauta.nextPiece != null) + { + // Draw next piece + AffineTransform save = g2.getTransform(); + lauta.nextPiece.paint(g2, 830, 325, 90); + g2.setTransform(save); + } } else { @@ -631,7 +634,8 @@ // Animate components lauta.animate(gameClock); - lauta.nextPiece.animate(gameClock); + if (lauta.nextPiece != null) + lauta.nextPiece.animate(gameClock); // Repaint with a frame limiter if (gameClock % 4 == 1)