summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-04-27 23:55:18 +0200
committerPetr Mrázek <peterix@gmail.com>2016-04-27 23:55:18 +0200
commit72c92893a5669a91e3d48b1341b6fde306db9a54 (patch)
tree9d0e01459c7589b5f52de363898369b0f69b83c2
parent0890a81695b3770cde58807dfd7967ea5e0e1b47 (diff)
downloadMultiMC-72c92893a5669a91e3d48b1341b6fde306db9a54.tar
MultiMC-72c92893a5669a91e3d48b1341b6fde306db9a54.tar.gz
MultiMC-72c92893a5669a91e3d48b1341b6fde306db9a54.tar.lz
MultiMC-72c92893a5669a91e3d48b1341b6fde306db9a54.tar.xz
MultiMC-72c92893a5669a91e3d48b1341b6fde306db9a54.zip
GH-1556 do not crash when instance has no update task while creating an instance
-rw-r--r--application/MainWindow.cpp5
-rw-r--r--application/dialogs/ProgressDialog.cpp7
2 files changed, 11 insertions, 1 deletions
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp
index f059b275..da9ea779 100644
--- a/application/MainWindow.cpp
+++ b/application/MainWindow.cpp
@@ -1185,7 +1185,10 @@ void MainWindow::finalizeInstance(InstancePtr inst)
QString error = QString("Instance load failed: %1").arg(reason);
CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning)->show();
});
- loadDialog.execWithTask(update.get());
+ if(update)
+ {
+ loadDialog.execWithTask(update.get());
+ }
}
else
{
diff --git a/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp
index bca4e168..17ab79cd 100644
--- a/application/dialogs/ProgressDialog.cpp
+++ b/application/dialogs/ProgressDialog.cpp
@@ -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;