Fix NPE in SQLiteDatabase#updateWithOnConflict

Bug 3188586

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

Change-Id: Ic2df542b2cdbdb7571080eb7f0fc6a4fe1678446
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 41bb364..7efb7fd 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -1081,7 +1081,7 @@
                 mConnectionPool.close();
             }
         } finally {
-            unlock();            
+            unlock();
         }
     }
 
@@ -1772,8 +1772,7 @@
      */
     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 @@
         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;
@@ -2118,7 +2118,7 @@
 
             int maxCacheSz = (mConnectionNum == 0) ? mMaxSqlCacheSize :
                     mParentConnObj.mMaxSqlCacheSize;
-            
+
             if (SQLiteDebug.DEBUG_SQL_CACHE) {
                 boolean printWarning = (mConnectionNum == 0)
                         ? (!mCacheFullWarning && mCompiledQueries.size() == maxCacheSz)