Bug 890218 - [MMS] If reboot device while downloading MMS attachment, the message will be empty and will not be deleted anymore. r=gene
authorChia-hung Tai <ctai@mozilla.com>
Thu, 11 Jul 2013 10:03:47 +0800
changeset 138469 9cd23670d3a3e5bd1b1fefa311f10e55c42af688
parent 138468 dc9dad068c5d09b53242ebafcaef49aaf3750201
child 138470 7cfd5e50d336d62702b663f70221e2511d693fd4
push idunknown
push userunknown
push dateunknown
reviewersgene
bugs890218
milestone25.0a1
Bug 890218 - [MMS] If reboot device while downloading MMS attachment, the message will be empty and will not be deleted anymore. r=gene
dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
--- a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
+++ b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
@@ -775,16 +775,21 @@ MobileMessageDatabaseService.prototype =
       let attachments = [];
       let parts = aMessageRecord.parts;
       if (parts) {
         for (let i = 0; i < parts.length; i++) {
           let part = parts[i];
           if (DEBUG) {
             debug("MMS: part[" + i + "]: " + JSON.stringify(part));
           }
+          // Sometimes the part is incomplete because the device reboots when
+          // downloading MMS. Don't need to expose this part to the content.
+          if (!part) {
+            continue;
+          }
 
           let partHeaders = part["headers"];
           let partContent = part["content"];
           // Don't need to make the SMIL part if it's present.
           if (partHeaders["content-type"]["media"] == "application/smil") {
             smil = partContent;
             continue;
           }