mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-09-02 21:19:25 +00:00
GH-4299 Don't hard crash on when missing network
This commit is contained in:
parent
4063a496d7
commit
6fe07561fe
@ -98,6 +98,12 @@ void NetJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTotal)
|
|||||||
|
|
||||||
void NetJob::executeTask()
|
void NetJob::executeTask()
|
||||||
{
|
{
|
||||||
|
if(!m_network) {
|
||||||
|
qCritical() << "Attempted to start NetJob" << objectName() << "without the network set!";
|
||||||
|
emitFailed(tr("Internal error: NetJob '%1' has been started without a network pointer!").arg(objectName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// hack that delays early failures so they can be caught easier
|
// hack that delays early failures so they can be caught easier
|
||||||
QMetaObject::invokeMethod(this, "startMoreParts", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "startMoreParts", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
@ -67,15 +67,6 @@ public slots:
|
|||||||
virtual bool abort() override;
|
virtual bool abort() override;
|
||||||
virtual void start(shared_qobject_ptr<QNetworkAccessManager> network) {
|
virtual void start(shared_qobject_ptr<QNetworkAccessManager> network) {
|
||||||
m_network = network;
|
m_network = network;
|
||||||
start();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void start() override {
|
|
||||||
if(!m_network) {
|
|
||||||
throw "Missing network while trying to start " + objectName();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Task::start();
|
Task::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user