From fb4c42490e596e5a18b2624a47026c8d03132ad9 Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Fri, 17 Oct 2025 22:37:45 -0700 Subject: [PATCH] fix(webui): use optional chaining operator for `maxLevelCap` (#2904) For items that not in itemMap Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2904 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> --- static/webui/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/webui/script.js b/static/webui/script.js index ab1a894d..697631cd 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -832,7 +832,7 @@ function updateInventory() { const td = document.createElement("td"); td.classList = "text-end text-nowrap"; - let maxXP = Math.pow(itemMap[item.ItemType].maxLevelCap ?? 30, 2) * 1000; + let maxXP = Math.pow(itemMap[item.ItemType]?.maxLevelCap ?? 30, 2) * 1000; if ( category != "Suits" && category != "SpaceSuits" && @@ -859,7 +859,7 @@ function updateInventory() { } } if ( - itemMap[item.ItemType].maxLevelCap > 30 && + itemMap[item.ItemType]?.maxLevelCap > 30 && (item.Polarized ?? 0) < (itemMap[item.ItemType].maxLevelCap - 30) / 2 ) { const a = document.createElement("a");