Bug 596282 - Error in the js console if fullcount does not exists [r=mfinkle]
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/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);
}