From 0aec4f955857cde5a465409645d994aa0d3febd4 Mon Sep 17 00:00:00 2001 From: Kobe De Peuter Date: Wed, 8 Jan 2025 08:26:58 +0100 Subject: [PATCH] Avoid an error on the enemy page when switching pages. --- extension/changelog.json | 3 ++- extension/scripts/features/enemy-filter/ttEnemyFilter.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/extension/changelog.json b/extension/changelog.json index 580cc5dfb..6dc36ac02 100644 --- a/extension/changelog.json +++ b/extension/changelog.json @@ -17,7 +17,8 @@ "contributor": "DeKleineKobini" }, { "message": "Improved performance while using FF Scouter in some cases.", "contributor": "DeKleineKobini" }, - { "message": "Route tornpal requests through the background to bypass Torn's CSP policy on Firefox.", "contributor": "DeKleineKobini" } + { "message": "Route tornpal requests through the background to bypass Torn's CSP policy on Firefox.", "contributor": "DeKleineKobini" }, + { "message": "Avoid an error on the enemy page when switching pages.", "contributor": "DeKleineKobini" } ], "changes": [{ "message": "Better optimize calls to tornpal.", "contributor": "DeKleineKobini" }], "removed": [] diff --git a/extension/scripts/features/enemy-filter/ttEnemyFilter.js b/extension/scripts/features/enemy-filter/ttEnemyFilter.js index 3809739a8..58f0c2e7e 100644 --- a/extension/scripts/features/enemy-filter/ttEnemyFilter.js +++ b/extension/scripts/features/enemy-filter/ttEnemyFilter.js @@ -21,6 +21,8 @@ if (!feature.enabled()) return; const content = findContainer("Enemy Filter", { selector: "main" }); + if (!content) return; + const statsEstimates = localFilters["Stats Estimate"]?.getSelections(content); if (!statsEstimates?.length) return;