From f05e0fe48aed464fdb6680a9b7a0082f9ac7f711 Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Fri, 15 Feb 2013 17:22:44 +0000 Subject: [PATCH] DroidFish: Avoid NPE if creating a MediaPlayer object fails. --- DroidFish/src/org/petero/droidfish/DroidFish.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java index e0d593b..647536c 100644 --- a/DroidFish/src/org/petero/droidfish/DroidFish.java +++ b/DroidFish/src/org/petero/droidfish/DroidFish.java @@ -2938,7 +2938,8 @@ public class DroidFish extends Activity implements GUIInterface { if (moveSound != null) moveSound.release(); moveSound = MediaPlayer.create(this, R.raw.movesound); - moveSound.start(); + if (moveSound != null) + moveSound.start(); } if (vibrateEnabled) { Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);