Skip to content

Commit 041a18e

Browse files
Prevent null where args from throwing exception on call to update
1 parent 9483458 commit 041a18e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2970,12 +2970,13 @@ public long insert(String table, int conflictAlgorithm,
29702970
@Override
29712971
public int update(String table, int conflictAlgorithm, ContentValues values,
29722972
String whereClause, Object[] whereArgs) {
2973-
String[] args = new String[whereArgs.length];
2974-
2975-
for (int i = 0; i < whereArgs.length; i++) {
2973+
int whereArgsLength = whereArgs == null
2974+
? 0
2975+
: whereArgs.length;
2976+
String[] args = new String[whereArgsLength];
2977+
for (int i = 0; i < whereArgsLength; i++) {
29762978
args[i] = whereArgs[i].toString();
29772979
}
2978-
29792980
return updateWithOnConflict(table, values, whereClause, args, conflictAlgorithm);
29802981
}
29812982

0 commit comments

Comments
 (0)