if (profileURLStr.Length() != 0)
if (profstr)
nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr){    nsresult rv;    nsCOMPtr<nsIURI> profileURL;    PRInt32 numProfiles=0;      NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);    if (NS_FAILED(rv)) return rv;    GetProfileCount(&numProfiles);  /*	 	 * Create the Application Shell instance...		 */    NS_WITH_SERVICE(nsIAppShellService, profAppShell,                    kAppShellServiceCID, &rv);    if (NS_FAILED(rv))        return rv;    char *isPregInfoSet = nsnull;    IsPregCookieSet(&isPregInfoSet); 		    PRBool pregPref = PR_FALSE;    rv = prefs->GetBoolPref(PREG_PREF, &pregPref);    //if (NS_FAILED(rv)) return rv;    if (profileURLStr.Length() == 0)        {            // This means that there was no command-line argument to force            // profile UI to come up. But we need the UI anyway if there            // are no profiles yet, or if there is more than one.            if (numProfiles == 0)                {                    if (pregPref)                        profileURLStr = PROFILE_PREG_URL;                    else                        profileURLStr = PROFILE_WIZARD_URL;                }            else if (numProfiles > 1)                profileURLStr = PROFILE_MANAGER_URL;        }    // Provide Preg information    if (pregPref && (PL_strcmp(isPregInfoSet, REGISTRY_TRUE_STRING) != 0))        profileURLStr = PROFILE_PREG_URL;    if (profileURLStr.Length() != 0)        {            rv = NS_NewURI(getter_AddRefs(profileURL), (const char *)profileURLStr);	            if (NS_FAILED(rv)) {                return rv;            }             nsCOMPtr<nsIWebShellWindow>  profWindow;            rv = profAppShell->CreateTopLevelWindow(nsnull, profileURL,                                                    PR_TRUE, PR_TRUE, NS_CHROME_ALL_CHROME,                                                    nsnull, 							NS_SIZETOCONTENT,           // width 							NS_SIZETOCONTENT,           // height                                                    getter_AddRefs(profWindow));            if (NS_FAILED(rv)) return rv;            /*             * Start up the main event loop...             */	            rv = profAppShell->Run();        }	// if we get here, and we don't have a current profile, 	// return a failure so we will exit	// this can happen, if the user hits Exit in the profile manager dialog	char *currentProfileStr = nsnull;	rv = GetCurrentProfile(&currentProfileStr);	if (NS_FAILED(rv) || !currentProfileStr || (PL_strlen(currentProfileStr) == 0)) {		return NS_ERROR_FAILURE;	}	PR_FREEIF(currentProfileStr);     if (pregPref && PL_strcmp(isPregInfoSet, REGISTRY_TRUE_STRING) != 0)        ProcessPRegCookie();        // Now we have the right profile, read the user-specific prefs.    rv = prefs->ReadUserPrefs();    return rv;}