Fixed check for null Anchor.

It was checking if the weak reference pointee was null, but not for a null
weak reference per se.

Fixes: 36643768
Test: manual verification
Test: CtsAutoFillServiceTestCases pass

Change-Id: I106dfd4a91ff1d45f8cb3141a992b06cbe460367
(cherry picked from commit dd23777dfbbe6299f5e07584c69c73ea0835fe46)
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index b63b899..7d243af 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -2178,9 +2178,14 @@
             update = true;
         }
 
-        final View anchor = mAnchor.get();
-        final int newAccessibilityIdOfAnchor = (anchor != null)
-                ? anchor.getAccessibilityViewId() : -1;
+        View anchor = null;
+        int newAccessibilityIdOfAnchor = -1;
+
+        if (mAnchor != null && mAnchor.get() != null) {
+            anchor = mAnchor.get();
+            newAccessibilityIdOfAnchor = anchor.getAccessibilityViewId();
+        }
+
         if (newAccessibilityIdOfAnchor != p.accessibilityIdOfAnchor) {
             p.accessibilityIdOfAnchor = newAccessibilityIdOfAnchor;
             update = true;