1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +00:00

LauncherCore: Add some more asserts

This commit is contained in:
Joshua Goins 2023-10-08 17:52:44 -04:00
parent dbb03bfeff
commit f44c392eb0

View file

@ -37,6 +37,8 @@ void LauncherCore::setSSL(QNetworkRequest &request)
void LauncherCore::setupIgnoreSSL(QNetworkReply *reply) void LauncherCore::setupIgnoreSSL(QNetworkReply *reply)
{ {
Q_ASSERT(reply != nullptr);
if (preferredProtocol() == QStringLiteral("http")) { if (preferredProtocol() == QStringLiteral("http")) {
connect(reply, &QNetworkReply::sslErrors, this, [reply](const QList<QSslError> &errors) { connect(reply, &QNetworkReply::sslErrors, this, [reply](const QList<QSslError> &errors) {
reply->ignoreSslErrors(errors); reply->ignoreSslErrors(errors);
@ -451,6 +453,8 @@ void LauncherCore::login(Profile *profile, const QString &username, const QStrin
bool LauncherCore::autoLogin(Profile *profile) bool LauncherCore::autoLogin(Profile *profile)
{ {
Q_ASSERT(profile != nullptr);
QString otp; QString otp;
if (profile->account()->useOTP()) { if (profile->account()->useOTP()) {
if (!profile->account()->rememberOTP()) { if (!profile->account()->rememberOTP()) {
@ -472,6 +476,7 @@ bool LauncherCore::autoLogin(Profile *profile)
GameInstaller *LauncherCore::createInstaller(Profile *profile) GameInstaller *LauncherCore::createInstaller(Profile *profile)
{ {
Q_ASSERT(profile != nullptr); Q_ASSERT(profile != nullptr);
return new GameInstaller(*this, *profile, this); return new GameInstaller(*this, *profile, this);
} }
@ -775,6 +780,8 @@ Profile *LauncherCore::currentProfile() const
void LauncherCore::setCurrentProfile(Profile *profile) void LauncherCore::setCurrentProfile(Profile *profile)
{ {
Q_ASSERT(profile != nullptr);
const int newIndex = m_profileManager->getProfileIndex(profile->name()); const int newIndex = m_profileManager->getProfileIndex(profile->name());
if (newIndex != m_currentProfileIndex) { if (newIndex != m_currentProfileIndex) {
m_currentProfileIndex = newIndex; m_currentProfileIndex = newIndex;