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

Commit 0cd57a44 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Switch SelectionBuilder to accept Object[], fix NPE.

Change-Id: I8d6ef1b47d89e4fc643402075f0549f4c4277a0f
parent cf2826ec
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public class SelectionBuilder {
     * Append the given selection clause to the internal state. Each clause is
     * surrounded with parenthesis and combined using {@code AND}.
     */
    public SelectionBuilder append(String selection, String... selectionArgs) {
    public SelectionBuilder append(String selection, Object... selectionArgs) {
        if (TextUtils.isEmpty(selection)) {
            if (selectionArgs != null && selectionArgs.length > 0) {
                throw new IllegalArgumentException(
@@ -63,8 +63,12 @@ public class SelectionBuilder {
        }

        mSelection.append("(").append(selection).append(")");
        for (String arg : selectionArgs) {
            mSelectionArgs.add(arg);
        if (selectionArgs != null) {
            for (Object arg : selectionArgs) {
                // TODO: switch to storing direct Object instances once
                // http://b/2464440 is fixed
                mSelectionArgs.add(String.valueOf(arg));
            }
        }

        return this;