Fix crash if no Minecraft version is selected in the new instance screen

This commit is contained in:
Kenneth Chew 2022-04-19 22:20:00 -04:00
parent 27e803e4a4
commit 0682fe544a
No known key found for this signature in database
GPG Key ID: F17D3E14A07739DA

View File

@ -118,7 +118,18 @@ void VanillaPage::filterChanged()
void VanillaPage::loaderFilterChanged() 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()) if(ui->noneFilter->isChecked())
{ {
ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // empty list ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // empty list