summaryrefslogtreecommitdiffstats
path: root/provider_src
diff options
context:
space:
mode:
Diffstat (limited to 'provider_src')
-rw-r--r--provider_src/com/android/email/provider/EmailProvider.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/provider_src/com/android/email/provider/EmailProvider.java b/provider_src/com/android/email/provider/EmailProvider.java
index a73cbf9e3..070a3e6bc 100644
--- a/provider_src/com/android/email/provider/EmailProvider.java
+++ b/provider_src/com/android/email/provider/EmailProvider.java
@@ -2243,7 +2243,22 @@ public class EmailProvider extends ContentProvider
updateValues.remove(BodyColumns.HTML_CONTENT);
updateValues.remove(BodyColumns.TEXT_CONTENT);
- result = db.update(tableName, updateValues, selection, selectionArgs);
+ // Since we removed the html and text values from the update operation,
+ // db.update() can fail because updateValues is empty. Just to a safe check
+ // before continue, and in case check if we found at least the selection
+ // record in db and fill the result variable for later hack check.
+ if (updateValues.size() == 0) {
+ final String proj[] = {BaseColumns._ID};
+ final Cursor c = db.query(Body.TABLE_NAME, proj, selection, selectionArgs,
+ null, null, null);
+ try {
+ result = c.getCount();
+ } finally {
+ c.close();
+ }
+ } else {
+ result = db.update(tableName, updateValues, selection, selectionArgs);
+ }
if (result == 0 && selection.equals(Body.SELECTION_BY_MESSAGE_KEY)) {
// TODO: This is a hack. Notably, the selection equality test above