Bug 1108168 - Check the type of a preference type before trying to call getBoolPref. r=dao

This commit is contained in:
Alexander J. Vincent 2014-12-08 12:49:50 -08:00
parent 2680f7fb29
commit 0d6d7b0e1a

View File

@ -756,11 +756,9 @@ function setLocalizedPref(aPrefName, aValue) {
* @returns aDefault if the requested pref doesn't exist.
*/
function getBoolPref(aName, aDefault) {
try {
return Services.prefs.getBoolPref(aName);
} catch (ex) {
if (Services.prefs.getPrefType(aName) != Ci.nsIPrefBranch.PREF_BOOL)
return aDefault;
}
return Services.prefs.getBoolPref(aName);
}
/**