Fix NPE in BridgeContext.obtainStyledAttributes() [DO NOT MERGE]

Replace direct member access with getter that checks for nullness.

Change-Id: I4a56a0ee903ae7d8c89b91d74b128302e1965586
(cherry picked from commit d758e042ce)
This commit is contained in:
Deepanshu Gupta
2015-05-28 12:33:04 -07:00
parent e698bb27f3
commit a287b8428a

View File

@@ -127,6 +127,7 @@ public final class BridgeContext extends Context {
new IdentityHashMap<Object, Map<String,String>>();
// maps for dynamically generated id representing style objects (StyleResourceValue)
@Nullable
private Map<Integer, StyleResourceValue> mDynamicIdToStyleMap;
private Map<StyleResourceValue, Integer> mStyleToDynamicIdMap;
private int mDynamicIdGenerator = 0x02030000; // Base id for R.style in custom namespace
@@ -695,7 +696,7 @@ public final class BridgeContext extends Context {
}
}
} else if (defStyleRes != 0) {
StyleResourceValue item = mDynamicIdToStyleMap.get(defStyleRes);
StyleResourceValue item = getStyleByDynamicId(defStyleRes);
if (item != null) {
defStyleValues = item;
} else {