Bug 735126 - Handle when second profile is created after Init() when there are no default profiles. r=bsmedberg
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 14 Mar 2012 17:08:58 -0700
changeset 89532 4528f1dd0abe8725aeb1b1aaf36d8b5750f04a96
parent 89531 36fd3090b006063201a8b3f98f54e57db42e02a6
child 89533 1761ac97c5170f6fad6a001ced4f87deced92b31
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbsmedberg
bugs735126
milestone14.0a1
Bug 735126 - Handle when second profile is created after Init() when there are no default profiles. r=bsmedberg
toolkit/profile/nsToolkitProfileService.cpp
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -481,17 +481,18 @@ nsToolkitProfileService::Init()
                                               rootDir, localDir,
                                               currentProfile);
         NS_ENSURE_TRUE(currentProfile, NS_ERROR_OUT_OF_MEMORY);
 
         rv = parser.GetString(profileID.get(), "Default", buffer);
         if (NS_SUCCEEDED(rv) && buffer.EqualsLiteral("1"))
             mChosen = currentProfile;
     }
-
+    if (!mChosen && mFirst && !mFirst->mNext) // only one profile
+        mChosen = mFirst;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsToolkitProfileService::SetStartWithLastProfile(bool aValue)
 {
     if (mStartWithLast != aValue) {
         mStartWithLast = aValue;