diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index fd7f17116..c125b4d59 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -270,7 +270,11 @@ function evalBinary(exp, workerScript){ resolve(expLeft*expRight); break; case "/": - resolve(expLeft/expRight); + if (expRight === 0) { + reject(makeRuntimeRejectMsg(workerScript, "ERROR: Divide by zero")); + } else { + resolve(expLeft/expRight); + } break; case "%": resolve(expLeft%expRight);