summaryrefslogtreecommitdiff
path: root/same-android/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'same-android/src/main/java')
-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()) {