diff --git a/browser/components/feeds/src/WebContentConverter.js b/browser/components/feeds/src/WebContentConverter.js index f096fd59eb56..0c1e47e25668 100644 --- a/browser/components/feeds/src/WebContentConverter.js +++ b/browser/components/feeds/src/WebContentConverter.js @@ -557,12 +557,30 @@ var WebContentConverterRegistrar = { * corresponding to the content handler to be registered */ _registerContentHandlerWithBranch: function(branch) { - var type = branch.getCharPref("type"); - var uri = branch.getComplexValue("uri", Ci.nsIPrefLocalizedString).data; - var title = branch.getComplexValue("title", Ci.nsIPrefLocalizedString).data; - this._registerContentHandler(type, uri, title); + /** + * Since we support up to six predefined readers, we need to handle gaps + * better, since the first branch with user-added values will be .6 + * + * How we deal with that is to check to see if there's no prefs in the + * branch and stop cycling once that's true. This doesn't fix the case + * where a user manually removes a reader, but that's not supported yet! + */ + var vals = branch.getChildList("", {}); + if (vals.length == 0) + return; + + try { + var type = branch.getCharPref("type"); + var uri = branch.getComplexValue("uri", Ci.nsIPrefLocalizedString).data; + var title = branch.getComplexValue("title", + Ci.nsIPrefLocalizedString).data; + this._registerContentHandler(type, uri, title); + } + catch(ex) { + // do nothing, the next branch might have values + } }, - + /** * Load the auto handler, content handler and protocol tables from * preferences.