mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-24 21:21:59 +00:00
Guard against undefined values in Shop purchases
This commit is contained in:
parent
906ec4082e
commit
68cf51e43a
@ -124,11 +124,14 @@ class ShopPurchaseState extends RebuyableMechanicState {
|
||||
return typeof cost === "function" ? cost() : cost;
|
||||
}
|
||||
|
||||
// ShopPurchaseData for any particular key is undefined in between page load and STD load,
|
||||
// so we need to guard against that causing NaNs to propagate through the save
|
||||
get purchases() {
|
||||
return ShopPurchaseData[this.config.key];
|
||||
return ShopPurchaseData[this.config.key] ?? 0;
|
||||
}
|
||||
|
||||
set purchases(value) {
|
||||
if (!Number.isFinite(value)) return;
|
||||
ShopPurchaseData[this.config.key] = value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user