Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c88f5760 authored by Robert Shih's avatar Robert Shih
Browse files

MediaPlayer2Impl: avoid NPE when accessing mHandlerThread

Bug: 109928575
Change-Id: I43d4ea528f702482ac197391b5bf236ff3794072
parent 2823d3ab
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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");
        }