Merge "guard against nulls in LogMaker" into oc-dev
am: ddf1d16504
Change-Id: Ife617e3f96339a411416f48ab84ea72a992d2b75
This commit is contained in:
@@ -54,7 +54,11 @@ public class LogMaker {
|
||||
|
||||
/* Deserialize from the eventlog */
|
||||
public LogMaker(Object[] items) {
|
||||
deserialize(items);
|
||||
if (items != null) {
|
||||
deserialize(items);
|
||||
} else {
|
||||
setCategory(MetricsEvent.VIEW_UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
/** @param category to replace the existing setting. */
|
||||
@@ -373,13 +377,13 @@ public class LogMaker {
|
||||
*/
|
||||
public void deserialize(Object[] items) {
|
||||
int i = 0;
|
||||
while (i < items.length) {
|
||||
while (items != null && i < items.length) {
|
||||
Object key = items[i++];
|
||||
Object value = i < items.length ? items[i++] : null;
|
||||
if (key instanceof Integer) {
|
||||
entries.put((Integer) key, value);
|
||||
} else {
|
||||
Log.i(TAG, "Invalid key " + key.toString());
|
||||
Log.i(TAG, "Invalid key " + (key == null ? "null" : key.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user