From 4d5e452ecedcc7b0ab756ce3ffd2c2aeaead71e7 Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Fri, 31 Aug 2012 12:45:01 -0400 Subject: [PATCH] CB-1358: Getting Force Close in incoming Cal while recording the Audio? --- framework/src/org/apache/cordova/AudioPlayer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/org/apache/cordova/AudioPlayer.java b/framework/src/org/apache/cordova/AudioPlayer.java index 90e0e164..37160125 100644 --- a/framework/src/org/apache/cordova/AudioPlayer.java +++ b/framework/src/org/apache/cordova/AudioPlayer.java @@ -207,7 +207,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On * @param file The name of the audio file. */ public void startPlaying(String file) { - if (this.readyPlayer(file)) { + if (this.readyPlayer(file) && this.player != null) { this.player.start(); this.setState(STATE.MEDIA_RUNNING); this.seekOnPrepared = 0; //insures this is always reset @@ -236,7 +236,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On public void pausePlaying() { // If playing, then pause - if (this.state == STATE.MEDIA_RUNNING) { + if (this.state == STATE.MEDIA_RUNNING && this.player != null) { this.player.pause(); this.setState(STATE.MEDIA_PAUSED); }