Merge "Fix invalid API use of XmlPullParser.getAttributeValue."

This commit is contained in:
Seigo Nonaka
2015-12-11 03:14:43 +00:00
committed by Android (Google) Code Review

View File

@@ -114,7 +114,8 @@ public class FontListParser {
if (parser.getEventType() != XmlPullParser.START_TAG) continue;
String tag = parser.getName();
if (tag.equals("font")) {
int ttcIndex = Integer.parseInt(parser.getAttributeValue("0", "ttcIndex"));
String ttcIndexStr = parser.getAttributeValue(null, "ttcIndex");
int ttcIndex = ttcIndexStr == null ? 0 : Integer.parseInt(ttcIndexStr);
String weightStr = parser.getAttributeValue(null, "weight");
int weight = weightStr == null ? 400 : Integer.parseInt(weightStr);
boolean isItalic = "italic".equals(parser.getAttributeValue(null, "style"));