From ac3f10f153319e2494fb57a90360031f148e404c Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Thu, 10 Dec 2015 18:23:37 -0800 Subject: [PATCH] Fix invalid API use of XmlPullParser.getAttributeValue. The 1st argument of the getAttributeValue is a namespace of the xml. Bug: 10861108 Change-Id: I73fd15eca7101b745870ca7b6509b1dbfcc9b0d7 --- graphics/java/android/graphics/FontListParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graphics/java/android/graphics/FontListParser.java b/graphics/java/android/graphics/FontListParser.java index e4494ca4b64cb..2596f53cb9f43 100644 --- a/graphics/java/android/graphics/FontListParser.java +++ b/graphics/java/android/graphics/FontListParser.java @@ -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"));