summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-04-19 20:13:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-04-19 20:13:32 +0000
commit62bb0802f9963c286c2c319b5e4447f43dce736d (patch)
tree5b8123bdeae77b9630de7e15deeac405496f6481
parent3f8884829f6dcea454a74c6cf18e4bd89cf70acc (diff)
parentd58b65cd31531445dd2dd53ae3135a9a85149d8f (diff)
Merge "Don't crash during layout of non-attached but focused view" into pi-dev
-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.