Correctly throw error when ns.run() is called with 0 threads

This commit is contained in:
Mason Dechaineux 2019-04-27 08:18:19 +10:00 committed by danielyxie
parent dd9df0a18c
commit 8fa7b112e1

@ -955,7 +955,7 @@ function NetscriptFunctions(workerScript) {
if (scriptname === undefined) {
throw makeRuntimeRejectMsg(workerScript, "run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)");
}
if (isNaN(threads) || threads < 0) {
if (isNaN(threads) || threads <= 0) {
throw makeRuntimeRejectMsg(workerScript, "Invalid argument for thread count passed into run(). Must be numeric and greater than 0");
}
var argsForNewScript = [];