From 8dfa505066a03cc8450527699634fda71cbd8915 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 10 Sep 2021 17:55:20 +0200 Subject: Return a failed MxcReply on invalid requests --- lib/networkaccessmanager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/networkaccessmanager.cpp') diff --git a/lib/networkaccessmanager.cpp b/lib/networkaccessmanager.cpp index 710ade4e..f37e26b6 100644 --- a/lib/networkaccessmanager.cpp +++ b/lib/networkaccessmanager.cpp @@ -73,12 +73,12 @@ QNetworkReply* NetworkAccessManager::createRequest( auto connection = AccountRegistry::instance().get(fragmentParts[0]); if(!connection) { qWarning() << "Connection not found"; - return nullptr; + return new MxcReply(); } auto room = connection->room(fragmentParts[1]); if(!room) { qWarning() << "Room not found"; - return nullptr; + return new MxcReply(); } QNetworkRequest r(request); r.setUrl(QUrl(QStringLiteral("%1/_matrix/media/r0/download/%2").arg(connection->homeserver().toString(), mediaId))); @@ -88,7 +88,7 @@ QNetworkReply* NetworkAccessManager::createRequest( auto connection = AccountRegistry::instance().get(fragment); if(!connection) { qWarning() << "Connection not found"; - return nullptr; + return new MxcReply(); } QNetworkRequest r(request); r.setUrl(QUrl(QStringLiteral("%1/_matrix/media/r0/download/%2").arg(connection->homeserver().toString(), mediaId))); @@ -96,7 +96,7 @@ QNetworkReply* NetworkAccessManager::createRequest( return new MxcReply(reply); } else { qWarning() << "Invalid request"; - return nullptr; + return new MxcReply(); } } auto reply = QNetworkAccessManager::createRequest(op, request, outgoingData); -- cgit v1.2.3