From bb68fa5806f6f0632a908a0d2c643133c52b0cfb Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 13 Jun 2018 12:34:32 -0400 Subject: [PATCH] fixed getServer instead --- src/NetscriptFunctions.js | 2 +- src/Server.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index c26e1e1a2..f2bfb3b0d 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -1199,7 +1199,7 @@ function NetscriptFunctions(workerScript) { return updateStaticRam("serverExists", CONSTANTS.ScriptGetServerRamCost); } updateDynamicRam("serverExists", CONSTANTS.ScriptGetServerRamCost); - return (getServer(ip) != null); + return (getServer(ip) !== null); }, fileExists : function(filename,ip=workerScript.serverIp) { if (workerScript.checkingRam) { diff --git a/src/Server.js b/src/Server.js index a9346fc96..54cf87202 100644 --- a/src/Server.js +++ b/src/Server.js @@ -873,9 +873,11 @@ function GetServerByHostname(hostname) { function getServer(s) { if (!isValidIPAddress(s)) { return GetServerByHostname(s); - } else { + } + if(AllServers[s] !== undefined) { return AllServers[s]; } + return null; } //Debugging tool