summaryrefslogtreecommitdiff
path: root/same-android/src/main/java/com
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-01 21:27:10 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-01 21:27:10 +0100
commit6572275c069699c753c906078580d7c507e120c6 (patch)
treef0d279e58ec713c2465d138cb0a0024f63d2fce1 /same-android/src/main/java/com
parentb6f6a0afdacead5c05a939511b5d0bee021f641e (diff)
Fix NPE in finalize that accessed a Canvas.tjws_test
Diffstat (limited to 'same-android/src/main/java/com')
-rw-r--r--same-android/src/main/java/com/orbekk/same/GameView.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/same-android/src/main/java/com/orbekk/same/GameView.java b/same-android/src/main/java/com/orbekk/same/GameView.java
index 31ac27c..d21d05d 100644
--- a/same-android/src/main/java/com/orbekk/same/GameView.java
+++ b/same-android/src/main/java/com/orbekk/same/GameView.java
@@ -86,11 +86,15 @@ public class GameView extends SurfaceView implements SurfaceHolder.Callback {
Canvas c = null;
try {
c = holder.lockCanvas();
- synchronized(holder) {
- doDraw(c);
+ if (c != null) {
+ synchronized(holder) {
+ doDraw(c);
+ }
}
} finally {
- holder.unlockCanvasAndPost(c);
+ if (c != null) {
+ holder.unlockCanvasAndPost(c);
+ }
}
synchronized (this) {
if (Thread.interrupted()) {