Avoid NPE when callers send null selection args.
Fixes http://b/2226007
diff --git a/core/java/android/content/ContentProviderOperation.java b/core/java/android/content/ContentProviderOperation.java
index 0467516..ca36df2 100644
--- a/core/java/android/content/ContentProviderOperation.java
+++ b/core/java/android/content/ContentProviderOperation.java
@@ -545,8 +545,12 @@
"only updates, deletes, and asserts can have selections");
}
mSelection = selection;
- mSelectionArgs = new String[selectionArgs.length];
- System.arraycopy(selectionArgs, 0, mSelectionArgs, 0, selectionArgs.length);
+ if (selectionArgs == null) {
+ mSelectionArgs = null;
+ } else {
+ mSelectionArgs = new String[selectionArgs.length];
+ System.arraycopy(selectionArgs, 0, mSelectionArgs, 0, selectionArgs.length);
+ }
return this;
}