Merge pull request #470 from kthchew/fix/ml-selector-crash

Fix crash if no Minecraft version is selected in the new instance screen
This commit is contained in:
dada513 2022-04-20 09:08:48 +02:00 committed by GitHub
commit 4e97f2a6fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,7 +118,18 @@ void VanillaPage::filterChanged()
void VanillaPage::loaderFilterChanged()
{
auto minecraftVersion = m_selectedVersion->descriptor();
QString minecraftVersion;
if (m_selectedVersion)
{
minecraftVersion = m_selectedVersion->descriptor();
}
else
{
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // empty list
ui->loaderVersionList->setEmptyString(tr("No Minecraft version is selected."));
ui->loaderVersionList->setEmptyMode(VersionListView::String);
return;
}
if(ui->noneFilter->isChecked())
{
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // empty list