From c1b38221d2849b2cc43e2d3484edf4c9f74ca8e9 Mon Sep 17 00:00:00 2001 From: An0n <79678786+an0n666@users.noreply.github.com> Date: Sun, 27 Mar 2022 13:15:13 +0600 Subject: [PATCH] Fix WebUI crash due to missing tags from config Tags can be missing from config but set inside .fastresume. May happen due to corrupted/deleted config. Closes #11906. PR #16739. Original PR #16711. --- src/webui/www/private/scripts/client.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 94b9ec558..386487f91 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -361,6 +361,12 @@ window.addEvent('load', function() { let added = false; for (let i = 0; i < tags.length; ++i) { const tagHash = genHash(tags[i].trim()); + if (!tagList[tagHash]) { // This should not happen + tagList[tagHash] = { + name: tags, + torrents: [] + }; + } if (!Object.contains(tagList[tagHash].torrents, torrent['hash'])) { added = true; tagList[tagHash].torrents.push(torrent['hash']);