From 6fe07561fe8dc32d61b7c50ed962faa87eba78eb Mon Sep 17 00:00:00 2001 From: Janrupf Date: Wed, 29 Dec 2021 16:54:20 +0100 Subject: [PATCH] GH-4299 Don't hard crash on when missing network --- launcher/net/NetJob.cpp | 6 ++++++ launcher/net/NetJob.h | 9 --------- 2 files changed, 6 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..2f272da4 100644 --- a/launcher/net/NetJob.h +++ b/launcher/net/NetJob.h @@ -67,15 +67,6 @@ public slots: virtual bool abort() override; virtual void start(shared_qobject_ptr network) { m_network = network; - start(); - } - -protected slots: - void start() override { - if(!m_network) { - throw "Missing network while trying to start " + objectName(); - return; - } Task::start(); }