From 11cfe38d1c94b039e1c330759fe7b34b9c9a31f8 Mon Sep 17 00:00:00 2001 From: An0n <79678786+an0n666@users.noreply.github.com> Date: Sat, 26 Mar 2022 09:56:18 +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 #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 63ff6ac23..eaa120e18 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -374,6 +374,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']);