From 65f1d8d836af1f33b87f6f80c7c9d878c7e38858 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 20:20:15 +0100 Subject: [PATCH] Fix TypeError when loading UI with custom palette selected (#5205) * Add null check to fix circular dependency with custom palettes Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> * Refactor: move null check earlier for better efficiency Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> --- wled00/data/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/data/index.js b/wled00/data/index.js index 9371e3a3..7cb989d0 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -1283,7 +1283,8 @@ function updateSelectedPalette(s) if (selElement) selElement.classList.remove('selected'); var selectedPalette = parent.querySelector(`.lstI[data-id="${s}"]`); - if (selectedPalette) parent.querySelector(`.lstI[data-id="${s}"]`).classList.add('selected'); + if (!selectedPalette) return; // palette not yet loaded (custom palette on initial load) + selectedPalette.classList.add('selected'); // Display selected palette name on button in simplified UI let selectedName = selectedPalette.querySelector(".lstIname").innerText;