From 21f15a47bc59c7851e6331e0671c590f10c72316 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 9 Mar 2019 12:59:58 +0100 Subject: [PATCH] Fixed: If no profile found, don't process the default one --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 4 ++-- .../client/ryzom_installer/src/mainwindow.cpp | 16 ++++++++++++++++ .../ryzom_installer/src/operationdialog.cpp | 6 ++++++ .../ryzom_installer/src/uninstalldialog.cpp | 3 +++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 889dec9cb..d23119b27 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -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) diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index e89a1f07d..16e0c8bad 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -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 diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index ec0a21714..e9d6fdebd 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -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(); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp index 1330a16bf..e346d7a00 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp @@ -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));