mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 14:15:16 +01:00
DroidFish: Avoid crash if playing a move sound fails.
This commit is contained in:
parent
ffa0e1a240
commit
eb00cf60de
|
@ -81,6 +81,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.Resources.NotFoundException;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.media.MediaPlayer;
|
||||
|
@ -3136,9 +3137,12 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
if (soundEnabled) {
|
||||
if (moveSound != null)
|
||||
moveSound.release();
|
||||
moveSound = MediaPlayer.create(this, R.raw.movesound);
|
||||
if (moveSound != null)
|
||||
moveSound.start();
|
||||
try {
|
||||
moveSound = MediaPlayer.create(this, R.raw.movesound);
|
||||
if (moveSound != null)
|
||||
moveSound.start();
|
||||
} catch (NotFoundException ex) {
|
||||
}
|
||||
}
|
||||
if (vibrateEnabled) {
|
||||
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||
|
|
Loading…
Reference in New Issue
Block a user