Prevent new profile crash due to uninitialized global object

This commit is contained in:
Mark Watkins 2014-07-12 21:05:17 +10:00
parent 87d848ff14
commit bdea52af4d

View File

@ -774,13 +774,13 @@ Profile *Create(QString name)
} }
//path+="/"+name; //path+="/"+name;
Profile *prof = new Profile(path); p_profile = new Profile(path);
prof->Open(); p_profile->Open();
profiles[name] = prof; profiles[name] = p_profile;
prof->user->setUserName(name); p_profile->user->setUserName(name);
//prof->Set("Realname",realname); //p_profile->Set("Realname",realname);
//if (!password.isEmpty()) prof.user->setPassword(password); //if (!password.isEmpty()) p_profile.user->setPassword(password);
prof->Set(STR_GEN_DataFolder, QString("{home}/Profiles/{") + QString(STR_UI_UserName) + p_profile->Set(STR_GEN_DataFolder, QString("{home}/Profiles/{") + QString(STR_UI_UserName) +
QString("}")); QString("}"));
Machine *m = new Machine(0); Machine *m = new Machine(0);
@ -790,11 +790,11 @@ Profile *Create(QString name)
m->properties[STR_PROP_Serial] = m->hexid(); m->properties[STR_PROP_Serial] = m->hexid();
m->properties[STR_PROP_Path] = "{DataFolder}/" + m->GetClass() + "_" + m->hexid(); m->properties[STR_PROP_Path] = "{DataFolder}/" + m->GetClass() + "_" + m->hexid();
m->SetType(MT_JOURNAL); m->SetType(MT_JOURNAL);
prof->AddMachine(m); p_profile->AddMachine(m);
prof->Save(); p_profile->Save();
return prof; return p_profile;
} }
Profile *Get() Profile *Get()