From 37e6a9ebc25e5b81e4ded255e3277891a9ede0ab Mon Sep 17 00:00:00 2001 From: Kevin Cox Date: Wed, 16 Feb 2022 23:20:54 -0500 Subject: [PATCH] Fix UI crash when torrent is in non-existent category. This checks that `category_list[categoryHash].torrents` is truthy before dereferencing it. In some cases the API response will have a torrent in a category that doesn't exist resulting in the check to return `undefined` which is not `null`. This broadens the check so that it will create the category even if null. PR #16432. --- src/webui/www/private/scripts/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 5d77a5985..94b9ec558 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -320,7 +320,7 @@ window.addEvent('load', function() { return true; } const categoryHash = genHash(category); - if (category_list[categoryHash] === null) // This should not happen + if (!category_list[categoryHash]) // This should not happen category_list[categoryHash] = { name: category, torrents: []