MISC: Enforce stricter param check on ns.getBitNodeMultipliers and ns.hacknet.spendHashes (#2085)

This commit is contained in:
catloversg
2025-04-15 06:20:36 +07:00
committed by GitHub
parent 44b8baa8ad
commit 31e6e4d74b
4 changed files with 9 additions and 18 deletions
+3 -4
View File
@@ -201,10 +201,9 @@ export function NetscriptHacknet(): InternalAPI<IHacknet> {
(_upgName, _upgTarget = "", _count = 1) => {
const upgName = helpers.string(ctx, "upgName", _upgName);
const upgTarget = helpers.string(ctx, "upgTarget", _upgTarget);
const count = Math.floor(helpers.number(ctx, "count", _count));
// TODO (3.0.0): use helpers.positiveInteger
if (!(count >= 0)) {
throw helpers.errorMessage(ctx, "count may not be negative");
const count = helpers.integer(ctx, "count", _count);
if (count < 0) {
throw helpers.errorMessage(ctx, "Count must be a non-negative integer.");
}
if (!hasHacknetServers()) {
return false;