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

Commit 791c4845 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

MediaPlayer: do not crash when there is no context

Prevent NPE when the instance is running without a context.
  This enables writing command-line test apps.

Test: vendor/google_toolbox/team/audio/cmds/ClMediaPlayer
Change-Id: Ie74112334675c5d9d3efdb28c7178c49d8729acb
parent 196bbe7a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2291,7 +2291,7 @@ public class MediaPlayer extends PlayerBase
     * {@link #setSubtitleAnchor(SubtitleController, Anchor)} (e.g. {@link VideoView} provides one).
     */
    private synchronized void setSubtitleAnchor() {
        if (mSubtitleController == null) {
        if ((mSubtitleController == null) && (ActivityThread.currentApplication() != null)) {
            final HandlerThread thread = new HandlerThread("SetSubtitleAnchorThread");
            thread.start();
            Handler handler = new Handler(thread.getLooper());