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

Commit 76ced03e authored by Flavio Lerda's avatar Flavio Lerda
Browse files

Follow-up on previous fix.

Correctly handle the case of a null country iso when working with an
upgraded call log.

The syntax for nulls requires the value to be passes as "IS NULL"
instead of using "= ?" and passing a null value.

Bug: 5638376
Change-Id: Icdc0278570495d4abff453e8505649c2b7425c99
parent eb765ac7
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -650,14 +650,15 @@ import libcore.util.Objects;
            return;
        }

        StringBuilder where = new StringBuilder();
        where.append(Calls.NUMBER);
        where.append(" = ? AND ");
        where.append(Calls.COUNTRY_ISO);
        where.append(" = ?");

        if (countryIso == null) {
            mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
                    Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " IS NULL",
                    new String[]{ number });
        } else {
            mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
                where.toString(), new String[]{ number, countryIso });
                    Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " = ?",
                    new String[]{ number, countryIso });
        }
    }

    /** Returns the contact information as stored in the call log. */