diff options
| author | 2018-11-14 20:04:33 +0000 | |
|---|---|---|
| committer | 2018-11-14 20:04:33 +0000 | |
| commit | 79e4b948cd059993eeb7b326bd90c2149af54a36 (patch) | |
| tree | af774917ee02b335161ce926343bf558b4677198 | |
| parent | 6b3cb1e3a82862807ad67742759110a2141e8e50 (diff) | |
| parent | c88f57609f7f0ab5f82dd65e84429dd29dff26c3 (diff) | |
Merge "MediaPlayer2Impl: avoid NPE when accessing mHandlerThread"
| -rw-r--r-- | media/java/android/media/MediaPlayer2Impl.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/media/java/android/media/MediaPlayer2Impl.java b/media/java/android/media/MediaPlayer2Impl.java index 4ac0188581e8..9b97b1060c8a 100644 --- a/media/java/android/media/MediaPlayer2Impl.java +++ b/media/java/android/media/MediaPlayer2Impl.java @@ -700,7 +700,8 @@ public final class MediaPlayer2Impl extends MediaPlayer2 { // return true if there is a next data source, false otherwise. // This function should be always called on |mHandlerThread|. private boolean prepareNextDataSource() { - if (Looper.myLooper() != mHandlerThread.getLooper()) { + HandlerThread handlerThread = mHandlerThread; + if (handlerThread != null && Looper.myLooper() != handlerThread.getLooper()) { Log.e(TAG, "prepareNextDataSource: called on wrong looper"); } @@ -736,7 +737,8 @@ public final class MediaPlayer2Impl extends MediaPlayer2 { // This function should be always called on |mHandlerThread|. private void playNextDataSource() { - if (Looper.myLooper() != mHandlerThread.getLooper()) { + HandlerThread handlerThread = mHandlerThread; + if (handlerThread != null && Looper.myLooper() != handlerThread.getLooper()) { Log.e(TAG, "playNextDataSource: called on wrong looper"); } |