mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-12-26 18:14:22 +00:00
Fix java detection segfault
This commit is contained in:
parent
c8b84257ae
commit
ba938dd8e2
@ -834,18 +834,20 @@ void MainWindow::checkSetDefaultJava()
|
|||||||
vselect.setResizeOn(2);
|
vselect.setResizeOn(2);
|
||||||
vselect.exec();
|
vselect.exec();
|
||||||
|
|
||||||
if (!vselect.selectedVersion())
|
if (vselect.selectedVersion())
|
||||||
|
java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
|
||||||
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Invalid version selected"),
|
QMessageBox::warning(this, tr("Invalid version selected"),
|
||||||
tr("You didn't select a valid Java version, so MultiMC will "
|
tr("You didn't select a valid Java version, so MultiMC will "
|
||||||
"select the default. "
|
"select the default. "
|
||||||
"You can change this in the settings dialog."));
|
"You can change this in the settings dialog."));
|
||||||
|
|
||||||
JavaUtils ju;
|
JavaUtils ju;
|
||||||
java = ju.GetDefaultJava();
|
java = ju.GetDefaultJava();
|
||||||
}
|
}
|
||||||
|
if(java)
|
||||||
java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
|
|
||||||
MMC->settings()->set("JavaPath", java->path);
|
MMC->settings()->set("JavaPath", java->path);
|
||||||
|
else
|
||||||
|
MMC->settings()->set("JavaPath", QString("java"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user