NOISSUE shortcut creation: add version blacklist for joining server on launch

These versions are known to crash when joining a server on launch (see MC-145102 and MC-228828)
This commit is contained in:
arthomnix 2022-07-03 15:47:26 +01:00
parent bbdbe47e72
commit 7938585abb
2 changed files with 27 additions and 0 deletions

View File

@ -11,6 +11,8 @@
#include "ui_CreateShortcutDialog.h"
#include "Application.h"
#include "minecraft/auth/AccountList.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "icons/IconList.h"
#ifdef Q_OS_WIN
@ -38,6 +40,15 @@ CreateShortcutDialog::CreateShortcutDialog(QWidget *parent, InstancePtr instance
ui->profileComboBox->setCurrentText(accounts->defaultAccount()->profileName());
}
if (m_instance->typeName() == "Minecraft")
{
MinecraftInstancePtr minecraftInstance = qobject_pointer_cast<MinecraftInstance>(m_instance);
QString version = minecraftInstance->getPackProfile()->getComponentVersion("net.minecraft");
bool enableJoinServer = QRegExp(JOIN_SERVER_DISALLOWED_VERSIONS).exactMatch(version);
ui->joinServerCheckBox->setEnabled(enableJoinServer);
ui->joinServer->setEnabled(enableJoinServer);
}
#if defined(Q_OS_UNIX) && !defined(Q_OS_LINUX)
ui->createScriptCheckBox->setEnabled(false);
ui->createScriptCheckBox->setChecked(true);

View File

@ -15,6 +15,22 @@
#include <windows.h>
#endif
const QString JOIN_SERVER_DISALLOWED_VERSIONS(
"(19w0[89][a-z])"
"|(19w1[0-9][a-z])"
"|(1.14.?[1-4]?-pre[0-9])"
"|(1.14.?[1-4]?)"
"|(19w[34][0-9][a-z])"
"|(1.15.?[0-9]?-pre[0-9])"
"|(1.15.?[0-9]?)"
"|(20w[01][0-9][a-z])"
"|(20w20a)"
"|(21w[12][0-9][a-z])"
"|(1.17-pre[0-9])"
"|(1.17-rc[0-9])"
"|(1.17)"
);
namespace Ui
{
class CreateShortcutDialog;