Fix #2275 accepts NaN donation bug

This commit is contained in:
Woody Lam 2022-01-05 01:00:10 +00:00
parent f9fd7a48f8
commit 3ca36fca95

@ -1179,8 +1179,7 @@ export function NetscriptSingularity(
helper.updateDynamicRam("donateToFaction", getRamCost("donateToFaction")); helper.updateDynamicRam("donateToFaction", getRamCost("donateToFaction"));
helper.checkSingularityAccess("donateToFaction", 3); helper.checkSingularityAccess("donateToFaction", 3);
const faction = getFaction("donateToFaction", name); const faction = getFaction("donateToFaction", name);
if (typeof amt !== "number" || amt <= 0 || isNaN(amt)) {
if (typeof amt !== "number" || amt <= 0) {
workerScript.log("donateToFaction", () => `Invalid donation amount: '${amt}'.`); workerScript.log("donateToFaction", () => `Invalid donation amount: '${amt}'.`);
return false; return false;
} }