summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-10-24 01:47:54 +0200
committerPetr Mrázek <peterix@gmail.com>2013-10-24 01:47:54 +0200
commitba938dd8e2cf95110624a338a891e8395bc4a1d2 (patch)
treee5c94ea5f44a37f5b833964121e2a606d28f00c9
parentc8b84257ae6bd45573beabac0fd8c4313436f3c9 (diff)
downloadMultiMC-ba938dd8e2cf95110624a338a891e8395bc4a1d2.tar
MultiMC-ba938dd8e2cf95110624a338a891e8395bc4a1d2.tar.gz
MultiMC-ba938dd8e2cf95110624a338a891e8395bc4a1d2.tar.lz
MultiMC-ba938dd8e2cf95110624a338a891e8395bc4a1d2.tar.xz
MultiMC-ba938dd8e2cf95110624a338a891e8395bc4a1d2.zip
Fix java detection segfault
-rw-r--r--gui/mainwindow.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 608dacd5..8e43a3b1 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -834,18 +834,20 @@ void MainWindow::checkSetDefaultJava()
vselect.setResizeOn(2);
vselect.exec();
- if (!vselect.selectedVersion())
+ if (vselect.selectedVersion())
+ java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
+ else
{
QMessageBox::warning(this, tr("Invalid version selected"),
tr("You didn't select a valid Java version, so MultiMC will "
"select the default. "
"You can change this in the settings dialog."));
-
JavaUtils ju;
java = ju.GetDefaultJava();
}
-
- java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion());
- MMC->settings()->set("JavaPath", java->path);
+ if(java)
+ MMC->settings()->set("JavaPath", java->path);
+ else
+ MMC->settings()->set("JavaPath", QString("java"));
}
}