diff options
author | Petr Mrázek <peterix@users.noreply.github.com> | 2021-12-30 19:58:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-30 19:58:16 +0100 |
commit | 5e909a4e852a5bf3ba9dec9081b4839773bfc0ce (patch) | |
tree | d7e4e6da909c2f01d66712159e28520c47940ec3 /launcher/net | |
parent | e7b90a9a3cf0e45a510750b01e4fcf2f6eaced1e (diff) | |
parent | be029ab36015bfc19a40e27a42ab10be03e6eea5 (diff) | |
download | PrismLauncher-5e909a4e852a5bf3ba9dec9081b4839773bfc0ce.tar.gz PrismLauncher-5e909a4e852a5bf3ba9dec9081b4839773bfc0ce.tar.bz2 PrismLauncher-5e909a4e852a5bf3ba9dec9081b4839773bfc0ce.zip |
Merge pull request #4394 from Janrupf/develop
GH-4299 Fix Screenshot upload
Diffstat (limited to 'launcher/net')
-rw-r--r-- | launcher/net/NetJob.cpp | 6 | ||||
-rw-r--r-- | launcher/net/NetJob.h | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/launcher/net/NetJob.cpp b/launcher/net/NetJob.cpp index 9bad89ed..b190b3e9 100644 --- a/launcher/net/NetJob.cpp +++ b/launcher/net/NetJob.cpp @@ -98,6 +98,12 @@ void NetJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTotal) 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 QMetaObject::invokeMethod(this, "startMoreParts", Qt::QueuedConnection); } diff --git a/launcher/net/NetJob.h b/launcher/net/NetJob.h index 45b9bc0f..06b23306 100644 --- a/launcher/net/NetJob.h +++ b/launcher/net/NetJob.h @@ -35,6 +35,11 @@ public: } virtual ~NetJob(); + void setNetwork(shared_qobject_ptr<QNetworkAccessManager> network) + { + m_network = network; + } + bool addNetAction(NetAction::Ptr action); NetAction::Ptr operator[](int index) @@ -67,15 +72,6 @@ public slots: virtual bool abort() override; virtual void start(shared_qobject_ptr<QNetworkAccessManager> network) { m_network = network; - start(); - } - -protected slots: - void start() override { - if(!m_network) { - throw "Missing network while trying to start " + objectName(); - return; - } Task::start(); } |