Fixed: If no profile found, don't process the default one

--HG--
branch : develop
This commit is contained in:
kervala 2019-03-09 12:59:58 +01:00
parent ab7ad10796
commit 21f15a47bc
4 changed files with 27 additions and 2 deletions

View file

@ -290,8 +290,8 @@ CProfile CConfigFile::getProfile(const QString &id) const
if (m_profiles[i].id == id) return m_profiles[i];
}
// default profile
return getProfile();
// no profile
return NoProfile;
}
void CConfigFile::setProfile(int i, const CProfile &profile)

View file

@ -103,6 +103,10 @@ void CMainWindow::updateButtons()
CConfigFile *config = CConfigFile::getInstance();
const CProfile &profile = config->getProfile(profileIndex);
// wrong profile
if (profile.id.isEmpty()) return;
const CServer &server = config->getServer(profile.server);
// get full path of client executable
@ -125,6 +129,10 @@ void CMainWindow::onPlayClicked()
CConfigFile *config = CConfigFile::getInstance();
const CProfile &profile = config->getProfile(profileIndex);
// wrong profile
if (profile.id.isEmpty()) return;
const CServer &server = config->getServer(profile.server);
// get full path of client executable
@ -162,6 +170,10 @@ void CMainWindow::onConfigureClicked()
CConfigFile *config = CConfigFile::getInstance();
const CProfile &profile = config->getProfile(profileIndex);
// wrong profile
if (profile.id.isEmpty()) return;
const CServer &server = config->getServer(profile.server);
// get full path of configuration executable
@ -310,6 +322,10 @@ void CMainWindow::onProfileChanged(int profileIndex)
CConfigFile *config = CConfigFile::getInstance();
CProfile profile = config->getProfile(profileIndex);
// wrong profile
if (profile.id.isEmpty()) return;
CServer server = config->getServer(profile.server);
// load changelog

View file

@ -926,6 +926,9 @@ bool COperationDialog::createProfileShortcuts(const QString &profileId)
const CProfile &profile = config->getProfile(profileId);
// wrong profile
if (profile.id.isEmpty()) return false;
m_currentOperation = tr("Creating shortcuts for profile %1...").arg(profile.id);
profile.createShortcuts();
@ -1080,6 +1083,9 @@ void COperationDialog::addComponentsProfiles()
{
const CProfile &profile = config->getProfile(profileId);
// wrong profile
if (profile.id.isEmpty()) continue;
profile.createShortcuts();
profile.createClientConfig();
}

View file

@ -257,6 +257,9 @@ void CUninstallDialog::updateSizes()
{
const CProfile &profile = config->getProfile(it.key());
// wrong profile
if (profile.id.isEmpty()) continue;
qint64 bytes = getDirectorySize(profile.getDirectory(), true);
emit updateSize(it.value(), qBytesToHumanReadable(bytes));