fix: fill upgrades array with empty strings (#1023)
Some checks failed
Build / build (18) (push) Has been cancelled
Build Docker image / docker (push) Waiting to run
Build / build (20) (push) Has been cancelled
Build / build (22) (push) Has been cancelled

Otherwise the client will "LogBug: (Invalid UpgradeId)" and may crash/raise an interrupt

Reviewed-on: #1023
Co-authored-by: Sainan <sainan@calamity.inc>
Co-committed-by: Sainan <sainan@calamity.inc>
This commit is contained in:
Sainan 2025-02-25 17:31:16 -08:00 committed by OrdisPrime
parent c13cf70814
commit 8fea608b76

View File

@ -544,6 +544,9 @@ export const applyDefaultUpgrades = (
for (const defaultUpgrade of defaultUpgrades) {
modsToGive.push({ ItemType: defaultUpgrade.ItemType, ItemCount: 1 });
if (defaultUpgrade.Slot != -1) {
while (upgrades.length < defaultUpgrade.Slot) {
upgrades.push("");
}
upgrades[defaultUpgrade.Slot] = defaultUpgrade.ItemType;
}
}