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

Commit c3e00c3f authored by Chulwoo Lee's avatar Chulwoo Lee
Browse files

Fix NPE while dispatching input event.

- occasionally, TvView can be detached while
  the input event is being processed.

BUG: 14791903
Change-Id: Id1def32ace1bf9765ae30a00ea4579670d1d40aa
parent e049c239
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewRootImpl;

/**
 * View playing TV
@@ -89,7 +90,10 @@ public class TvView extends SurfaceView {
            if (dispatchUnhandledInputEvent(event)) {
                return;
            }
            getViewRootImpl().dispatchUnhandledInputEvent(event);
            ViewRootImpl viewRootImpl = getViewRootImpl();
            if (viewRootImpl != null) {
                viewRootImpl.dispatchUnhandledInputEvent(event);
            }
        }
    };