OSDN Git Service

Add missing null checks
authorJohn Reck <jreck@google.com>
Mon, 27 Jun 2016 14:56:37 +0000 (07:56 -0700)
committerThe Android Automerger <android-build@google.com>
Mon, 27 Jun 2016 21:54:01 +0000 (14:54 -0700)
Bug: 29743482
Change-Id: Ic4bc5b9d5718eabd41e09a108a765b01aef4e3c8

core/java/android/view/SurfaceView.java

index ac10927..4818910 100644 (file)
@@ -745,6 +745,12 @@ public class SurfaceView extends View {
             Log.d(TAG, String.format("%d windowPositionLostRT RT, frameNr = %d",
                     System.identityHashCode(this), frameNumber));
         }
+        IWindowSession session = mSession;
+        MyWindow window = mWindow;
+        if (session == null || window == null) {
+            // We got detached prior to receiving this, abort
+            return;
+        }
         if (mRtHandlingPositionUpdates) {
             mRtHandlingPositionUpdates = false;
             // This callback will happen while the UI thread is blocked, so we can
@@ -757,7 +763,7 @@ public class SurfaceView extends View {
                             "postion = [%d, %d, %d, %d]", System.identityHashCode(this),
                             mWinFrame.left, mWinFrame.top,
                             mWinFrame.right, mWinFrame.bottom));
-                    mSession.repositionChild(mWindow, mWinFrame.left, mWinFrame.top,
+                    session.repositionChild(window, mWinFrame.left, mWinFrame.top,
                             mWinFrame.right, mWinFrame.bottom, frameNumber, mWinFrame);
                 } catch (RemoteException ex) {
                     Log.e(TAG, "Exception from relayout", ex);