summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Rosky <erosky@google.com> 2018-04-19 13:32:57 -0700
committer android-build-merger <android-build-merger@google.com> 2018-04-19 13:32:57 -0700
commit83976c5fa4054b766fe9e4ee41375a43ced67c25 (patch)
treea57dde2e31356af1a8dc8ac1bbdd309767b40499
parent5d5eba17c967d345dab9469c41c6f00d3a894dc4 (diff)
parent48cca289dfaeacdc40b6b506293eb4fe8cee7df0 (diff)
Merge "Don't crash during layout of non-attached but focused view" into pi-dev am: 62bb0802f9
am: 48cca289df Change-Id: Iea6f1656939f3630cee634d0054167204faf6829
-rw-r--r--core/java/android/view/View.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 71b60844b17d..6b16d42ac7ef 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -20700,7 +20700,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if (canTakeFocus()) {
// We have a robust focus, so parents should no longer be wanting focus.
clearParentsWantFocus();
- } else if (!getViewRootImpl().isInLayout()) {
+ } else if (getViewRootImpl() == null || !getViewRootImpl().isInLayout()) {
// This is a weird case. Most-likely the user, rather than ViewRootImpl, called
// layout. In this case, there's no guarantee that parent layouts will be evaluated
// and thus the safest action is to clear focus here.