Bug 596282 - Error in the js console if fullcount does not exists [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Thu, 16 Sep 2010 19:17:40 +0200
changeset 2016 a292fad385ac2e6a2dfc1c56c326af3333e025c7
parent 2015 00153c48ce281667d2eeaf01f9709eb0ff8f211b
child 2017 1e98355fc79d2c9771a6934db771abc9c3eee13f
push id1720
push uservnicolas@mozilla.com
push dateThu, 16 Sep 2010 17:17:55 +0000
reviewersmfinkle
bugs596282
Bug 596282 - Error in the js console if fullcount does not exists [r=mfinkle]
chrome/content/browser-ui.js
--- a/chrome/content/browser-ui.js
+++ b/chrome/content/browser-ui.js
@@ -2526,17 +2526,18 @@ var BadgeHandlers = {
         // Get the feed and read the count, passing any saved username and password
         // but do not show any security dialogs if we fail
         let req = new XMLHttpRequest();
         req.mozBackgroundRequest = true;
         req.open("GET", "https://mail.google.com/mail/feed/atom", true, login.username, login.password);
         req.onreadystatechange = function(aEvent) {
           if (req.readyState == 4) {
             if (req.status == 200) {
-              this._lastCount = req.responseXML.getElementsByTagName("fullcount")[0].childNodes[0].nodeValue;
+              let count = req.responseXML.getElementsByTagName("fullcount");
+              this._lastCount = count ? count[0].childNodes[0].nodeValue : 0;
             } else {
               this._lastCount = 0;
             }
             this._lastCount = BadgeHandlers.setNumberBadge(aBadge, this._lastCount);
           }
         };
         req.send(null);
       }