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

Commit 46a88513 authored by Brian Muramatsu's avatar Brian Muramatsu
Browse files

Fix NPE in SQLiteDatabase#updateWithOnConflict

Bug 3188586

...to restore old behavior of throwing IllegalArgumentException
when values is null.

Change-Id: Ic2df542b2cdbdb7571080eb7f0fc6a4fe1678446
parent 6e079a32
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1772,8 +1772,7 @@ public class SQLiteDatabase extends SQLiteClosable {
     */
    public int updateWithOnConflict(String table, ContentValues values,
            String whereClause, String[] whereArgs, int conflictAlgorithm) {
        int setValuesSize = values.size();
        if (values == null || setValuesSize == 0) {
        if (values == null || values.size() == 0) {
            throw new IllegalArgumentException("Empty values");
        }

@@ -1784,6 +1783,7 @@ public class SQLiteDatabase extends SQLiteClosable {
        sql.append(" SET ");

        // move all bind args to one array
        int setValuesSize = values.size();
        int bindArgsSize = (whereArgs == null) ? setValuesSize : (setValuesSize + whereArgs.length);
        Object[] bindArgs = new Object[bindArgsSize];
        int i = 0;