diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java index 76b961c393d653ee4688c4b5f91ef2a7e89e9a86..e7f1c51d5c5b9ff29256fefcdf51f5810ccd7c19 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadio.java +++ b/fmapp2/src/com/caf/fmradio/FMRadio.java @@ -496,14 +496,11 @@ public class FMRadio extends Activity Log.d(LOGTAG, "FMRadio: onResume"); super.onResume(); - if (null == mService) { - Log.e(LOGTAG, "FM Service is not running, returning"); - return; - } // TODO: We should return on exception or continue? try { - mService.registerCallbacks(mServiceCallbacks); + if (mService != null) + mService.registerCallbacks(mServiceCallbacks); } catch (RemoteException e) { e.printStackTrace(); } @@ -511,7 +508,8 @@ public class FMRadio extends Activity if (isSleepTimerActive()) { Log.d(LOGTAG, "isSleepTimerActive is true"); try { - mService.cancelDelayedStop(FMRadioService.STOP_SERVICE); + if (mService != null) + mService.cancelDelayedStop(FMRadioService.STOP_SERVICE); if(null != mSleepUpdateHandlerThread) { mSleepUpdateHandlerThread.interrupt(); } @@ -524,7 +522,8 @@ public class FMRadio extends Activity if (isRecording()) { Log.d(LOGTAG,"isRecordTimerActive is true"); try { - mService.cancelDelayedStop(FMRadioService.STOP_RECORD); + if (mService != null) + mService.cancelDelayedStop(FMRadioService.STOP_RECORD); } catch (Exception e) { e.printStackTrace(); } @@ -536,7 +535,8 @@ public class FMRadio extends Activity // we might lose audio focus between pause and restart, // hence request it again try { - mService.requestFocus(); + if (mService != null) + mService.requestFocus(); } catch (Exception e) { e.printStackTrace(); }