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

Commit 0437cac7 authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

Make getInt in BridgeTypedArray accept empty String.

The XML editor already warns about the empty strings in places where an
int value is required. There's no need to show another warning for it in
the rendering panel. Also, the rendering might have also failed when the
empty string is encountered. Try an continue the rendering, because no
rendering state is really bad.

Change-Id: I85106f37e4462f237e85f0b065b4ce8a4bfabf4d
parent a9090705
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -239,15 +239,12 @@ public final class BridgeTypedArray extends TypedArray {
    public int getInt(int index, int defValue) {
        String s = getString(index);
        try {
            if (s != null) {
            return convertValueToInt(s, defValue);
            }
        } catch (NumberFormatException e) {
            Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
                    String.format("\"%1$s\" in attribute \"%2$s\" is not a valid integer",
                            s, mNames[index]),
                    null);
            return defValue;
        }
        return defValue;
    }
@@ -949,7 +946,7 @@ public final class BridgeTypedArray extends TypedArray {
     * "XXXXXXXX" > 80000000.
     */
    private static int convertValueToInt(@Nullable String charSeq, int defValue) {
        if (null == charSeq)
        if (null == charSeq || charSeq.isEmpty())
            return defValue;

        int sign = 1;