mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 12:45:27 +00:00
Bug 1108168 - Check the type of a preference type before trying to call getBoolPref. r=dao
This commit is contained in:
parent
2680f7fb29
commit
0d6d7b0e1a
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user