Update NetscriptFunctions.ts

Undid removal of writePort data validation
This commit is contained in:
BrokenName 2021-12-27 10:38:00 -08:00
parent 7c846abb65
commit 90ca9407d5

@ -1758,6 +1758,12 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
return res; return res;
}, },
writePort: function (port: any, data: any = ""): any { writePort: function (port: any, data: any = ""): any {
if (typeof data !== "string" && typeof data !== "number") {
throw makeRuntimeErrorMsg(
"writePort",
`Trying to write invalid data to a port: only strings and numbers are valid.`,
);
}
const iport = helper.getValidPort("writePort", port); const iport = helper.getValidPort("writePort", port);
return Promise.resolve(iport.write(data)); return Promise.resolve(iport.write(data));
}, },