Validate RAM amount in ns.purchaseServer()

This commit is contained in:
nickofolas
2022-01-03 17:00:32 -06:00
parent dfae337d26
commit 23b21e63a0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ import { isPowerOfTwo } from "../utils/helpers/isPowerOfTwo";
*/
export function getPurchaseServerCost(ram: number): number {
const sanitizedRam = Math.round(ram);
if (isNaN(sanitizedRam) || !isPowerOfTwo(sanitizedRam)) {
if (isNaN(sanitizedRam) || !isPowerOfTwo(sanitizedRam) || !(Math.sign(sanitizedRam) === 1)) {
return Infinity;
}