diff options
author | Filip Gruszczynski <gruszczy@google.com> | 2015-06-03 10:32:26 -0700 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2015-06-03 13:13:08 -0700 |
commit | 48de126b71c22fb0ce36797ac1c46538395d08c0 (patch) | |
tree | e63ea8c9e20d8f12f8ed9f02a1a8d7432e83ae6c | |
parent | dc6d513803c8c67b6004b218129bff2c66b4c262 (diff) | |
download | frameworks_base-48de126b71c22fb0ce36797ac1c46538395d08c0.zip frameworks_base-48de126b71c22fb0ce36797ac1c46538395d08c0.tar.gz frameworks_base-48de126b71c22fb0ce36797ac1c46538395d08c0.tar.bz2 |
Fix NPE when requesting outsets for detached view.
Outsets are used during measure/layout pass, but this can be called on a
view that is not currently attached.
Bug: 21602590
Change-Id: I23e3acc45ca4bf7684d8913f839e29e8e9e94d78
-rw-r--r-- | core/java/android/view/View.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 37c8100..1e92a06 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -7366,7 +7366,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ public void getOutsets(Rect outOutsetRect) { - outOutsetRect.set(mAttachInfo.mOutsets); + if (mAttachInfo != null) { + outOutsetRect.set(mAttachInfo.mOutsets); + } else { + outOutsetRect.setEmpty(); + } } /** @@ -14508,7 +14512,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } - onDetachedFromWindow(); + onDetachedFromWindows(); onDetachedFromWindowInternal(); InputMethodManager imm = InputMethodManager.peekInstance(); |