diff options
| author | 2015-06-03 10:32:26 -0700 | |
|---|---|---|
| committer | 2015-06-03 10:43:48 -0700 | |
| commit | e660d4e96a2e5ac35f2dd6e2b43c588dd7e28358 (patch) | |
| tree | af4a503994f1496bbd33bf9a651c9e67e7c40b8c | |
| parent | 8c554b015e5c5b7393b5b099ddab046b834f44c9 (diff) | |
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 37c8100bebb0..1e92a067a2e3 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(); |