From 7b268614e134df14af8d06d31bf86f11d08a3197 Mon Sep 17 00:00:00 2001 From: ShanaryS Date: Tue, 27 May 2025 11:06:02 -0400 Subject: [PATCH] fix: early return for missing metadata --- src/webui/api/torrentscontroller.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 3a681664d..4e98fd9d6 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -744,6 +744,8 @@ void TorrentsController::filesAction() const BitTorrent::Torrent *const torrent = BitTorrent::Session::instance()->getTorrent(id); if (!torrent) throw APIError(APIErrorType::NotFound); + if (!torrent->hasMetadata()) + return setResult(QJsonArray{}); QList fileIndexes; const auto idxIt = params().constFind(u"indexes"_s); @@ -765,9 +767,6 @@ void TorrentsController::filesAction() }); } - if (!torrent->hasMetadata()) - return setResult(QJsonArray {}); - QJsonArray fileList = getFiles(torrent, fileIndexes); if (!fileList.isEmpty()) {