BUGFIX: Update NetscriptHelpers.tsx to verify servers are on network when getServer is called (#855)

This commit is contained in:
TheAimMan 2023-10-23 04:37:19 -04:00 committed by GitHub
parent 61c311a126
commit eed2c5d6d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -460,7 +460,7 @@ function scriptIdentifier(
*/
function getServer(ctx: NetscriptContext, hostname: string) {
const server = GetServer(hostname);
if (server == null) {
if (server == null || (server.serversOnNetwork.length == 0 && server.hostname != "home")) {
const str = hostname === "" ? "'' (empty string)" : "'" + hostname + "'";
throw makeRuntimeErrorMsg(ctx, `Invalid hostname: ${str}`);
}