Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f9bf95d authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Do not call parseInt if value is empty

Filling in stack trace when creating exception is expensive

Test: non-functional change, device boot ok
Bug: 30792387
Change-Id: Iccca26dec43370971a732068bd4d7053486da7a0
parent b8ce18a2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1594,6 +1594,9 @@ public class XmlUtils {

    public static int readIntAttribute(XmlPullParser in, String name, int defaultValue) {
        final String value = in.getAttributeValue(null, name);
        if (TextUtils.isEmpty(value)) {
            return defaultValue;
        }
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException e) {
@@ -1617,6 +1620,9 @@ public class XmlUtils {

    public static long readLongAttribute(XmlPullParser in, String name, long defaultValue) {
        final String value = in.getAttributeValue(null, name);
        if (TextUtils.isEmpty(value)) {
            return defaultValue;
        }
        try {
            return Long.parseLong(value);
        } catch (NumberFormatException e) {