AVRCP: Null check for playback state
Added null check for playback state in function
onPlaybackStateChanged before converting to null.
CRs-Fixed: 2450416
Change-Id: I3785ce2f19c6e0377f21c0df47417d39a5264097
diff --git a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
index 233bf51..4427c0d 100644
--- a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
+++ b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
@@ -719,7 +719,7 @@
}
@Override
public synchronized void onPlaybackStateChanged(PlaybackState state) {
- if (DEBUG) Log.v(TAG, "onPlaybackStateChanged: state " + state.toString());
+ if (DEBUG) Log.v(TAG, "onPlaybackStateChanged: state " + ((state != null)? state.toString() : "NULL"));
updateCurrentMediaState(null);
Log.v(TAG, " Exit onPlaybackStateChanged");
}
@@ -1820,7 +1820,7 @@
for (int i = 0; i < maxAvrcpConnections; i++) {
if (i != deviceIndex && !deviceFeatures[i].isActiveDevice &&
deviceFeatures[i].mLastRspPlayStatus == PLAYSTATUS_PLAYING &&
- (state.getState() == PlaybackState.STATE_PLAYING)) {
+ (state != null && state.getState() == PlaybackState.STATE_PLAYING)) {
PlaybackState.Builder playState = new PlaybackState.Builder();
playState.setState(PlaybackState.STATE_PAUSED,
PlaybackState.PLAYBACK_POSITION_UNKNOWN, 1.0f);