diff options
| author | 2019-02-28 17:22:36 -0800 | |
|---|---|---|
| committer | 2019-02-28 17:22:36 -0800 | |
| commit | 1196c0d3766f8bc167e7a22c2bfad37b4bf115fe (patch) | |
| tree | 63832f3be9bd3313db0dbc89f500ba7f6d165668 | |
| parent | f6833c92be6b87e837762328fc608eec240c4541 (diff) | |
Add null checks for attribute getters in View.
If the getter calls are made View#saveAttributeDataForStyleable
this might lead to null pointer exception. Add checks to prevent
that.
Test: None
Bug: 126780975
Change-Id: I3e27d6073b65367010bc9d5b002cf9791d434a72
| -rw-r--r-- | core/java/android/view/View.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 7afdc7055e42..bd95a95f1154 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5972,7 +5972,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @NonNull public List<Integer> getAttributeResolutionStack(@AttrRes int attribute) { ArrayList<Integer> stack = new ArrayList<>(); - if (!sDebugViewAttributes) { + if (!sDebugViewAttributes || mAttributeResolutionStacks == null) { return stack; } if (mSourceLayoutId != ID_NULL) { @@ -6004,7 +6004,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @NonNull public Map<Integer, Integer> getAttributeSourceResourceMap() { HashMap<Integer, Integer> map = new HashMap<>(); - if (!sDebugViewAttributes) { + if (!sDebugViewAttributes || mAttributeSourceResId == null) { return map; } for (int i = 0; i < mAttributeSourceResId.size(); i++) { |