Bug 1316279 - Part 2: Fix gfxPrefs::PrefGet string when using default value; r?dvander
MozReview-Commit-ID: AfPFlBo3h7t
--- a/gfx/thebes/gfxPrefs.cpp
+++ b/gfx/thebes/gfxPrefs.cpp
@@ -185,23 +185,27 @@ uint32_t gfxPrefs::PrefGet(const char* a
}
float gfxPrefs::PrefGet(const char* aPref, float aDefault)
{
MOZ_ASSERT(IsPrefsServiceAvailable());
return Preferences::GetFloat(aPref, aDefault);
}
-
std::string gfxPrefs::PrefGet(const char* aPref, std::string aDefault)
{
MOZ_ASSERT(IsPrefsServiceAvailable());
nsAdoptingCString result;
Preferences::GetCString(aPref, &result);
+
+ if (result.IsEmpty()) {
+ return aDefault;
+ }
+
return result.get();
}
void gfxPrefs::PrefSet(const char* aPref, bool aValue)
{
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::SetBool(aPref, aValue);
}