Fix crasher

This commit is contained in:
Christopher Eby 2010-04-12 23:45:51 -05:00
parent 38fb7abafd
commit 809192ab4f

View File

@ -771,10 +771,14 @@ public final class PlaybackService extends Service implements Handler.Callback,
private void setupReceiver()
{
if (mReceiver == null)
if (mReceiver == null) {
mReceiver = new Receiver();
else
unregisterReceiver(mReceiver);
} else {
try {
unregisterReceiver(mReceiver);
} catch (IllegalArgumentException e) {
}
}
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_HEADSET_PLUG);