mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 03:00:56 +02:00
CORPORATION: Added check to buy amount (#149)
This commit is contained in:
@@ -457,7 +457,8 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const cityName = helpers.city(ctx, "cityName", _cityName);
|
||||
const materialName = helpers.string(ctx, "materialName", _materialName);
|
||||
const amt = helpers.number(ctx, "amt", _amt);
|
||||
if (amt < 0) throw new Error("Invalid value for amount field! Must be numeric and greater than 0");
|
||||
if (amt < 0 || !Number.isFinite(amt))
|
||||
throw new Error("Invalid value for amount field! Must be numeric and greater than 0");
|
||||
const material = getMaterial(divisionName, cityName, materialName);
|
||||
BuyMaterial(material, amt);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user