GH-1556 do not crash when instance has no update task while creating an instance

This commit is contained in:
Petr Mrázek 2016-04-27 23:55:18 +02:00
parent 0890a81695
commit 72c92893a5
2 changed files with 11 additions and 1 deletions

View File

@ -1185,8 +1185,11 @@ void MainWindow::finalizeInstance(InstancePtr inst)
QString error = QString("Instance load failed: %1").arg(reason);
CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning)->show();
});
if(update)
{
loadDialog.execWithTask(update.get());
}
}
else
{
CustomMessageBox::selectable(this, tr("Error"), tr("MultiMC cannot download Minecraft or update instances unless you have at least "

View File

@ -17,6 +17,7 @@
#include "ui_ProgressDialog.h"
#include <QKeyEvent>
#include <QDebug>
#include "tasks/Task.h"
@ -57,6 +58,12 @@ int ProgressDialog::execWithTask(Task *task)
this->task = task;
QDialog::DialogCode result;
if(!task)
{
qDebug() << "Programmer error: progress dialog created with null task.";
return Accepted;
}
if(handleImmediateResult(result))
{
return result;