GH-1556 do not crash when instance has no update task while creating an instance
This commit is contained in:
parent
0890a81695
commit
72c92893a5
@ -1185,7 +1185,10 @@ void MainWindow::finalizeInstance(InstancePtr inst)
|
|||||||
QString error = QString("Instance load failed: %1").arg(reason);
|
QString error = QString("Instance load failed: %1").arg(reason);
|
||||||
CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning)->show();
|
CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning)->show();
|
||||||
});
|
});
|
||||||
loadDialog.execWithTask(update.get());
|
if(update)
|
||||||
|
{
|
||||||
|
loadDialog.execWithTask(update.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "ui_ProgressDialog.h"
|
#include "ui_ProgressDialog.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "tasks/Task.h"
|
#include "tasks/Task.h"
|
||||||
|
|
||||||
@ -57,6 +58,12 @@ int ProgressDialog::execWithTask(Task *task)
|
|||||||
this->task = task;
|
this->task = task;
|
||||||
QDialog::DialogCode result;
|
QDialog::DialogCode result;
|
||||||
|
|
||||||
|
if(!task)
|
||||||
|
{
|
||||||
|
qDebug() << "Programmer error: progress dialog created with null task.";
|
||||||
|
return Accepted;
|
||||||
|
}
|
||||||
|
|
||||||
if(handleImmediateResult(result))
|
if(handleImmediateResult(result))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user