fix(webui): use optional chaining operator for maxLevelCap (#2904)

For items that not in itemMap

Reviewed-on: OpenWF/SpaceNinjaServer#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>
This commit is contained in:
AMelonInsideLemon 2025-10-17 22:37:45 -07:00 committed by Sainan
parent 96a15e25df
commit fb4c42490e

View File

@ -832,7 +832,7 @@ function updateInventory() {
const td = document.createElement("td"); const td = document.createElement("td");
td.classList = "text-end text-nowrap"; 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 ( if (
category != "Suits" && category != "Suits" &&
category != "SpaceSuits" && category != "SpaceSuits" &&
@ -859,7 +859,7 @@ function updateInventory() {
} }
} }
if ( if (
itemMap[item.ItemType].maxLevelCap > 30 && itemMap[item.ItemType]?.maxLevelCap > 30 &&
(item.Polarized ?? 0) < (itemMap[item.ItemType].maxLevelCap - 30) / 2 (item.Polarized ?? 0) < (itemMap[item.ItemType].maxLevelCap - 30) / 2
) { ) {
const a = document.createElement("a"); const a = document.createElement("a");