mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
Add hasOwnProperty check to GetServer
This commit is contained in:
@@ -42,8 +42,11 @@ function GetServerByHostname(hostname: string): BaseServer | null {
|
||||
|
||||
//Get server by IP or hostname. Returns null if invalid
|
||||
export function GetServer(s: string): BaseServer | null {
|
||||
const server = AllServers[s];
|
||||
if (server) return server;
|
||||
if (AllServers.hasOwnProperty(s)) {
|
||||
const server = AllServers[s];
|
||||
if (server) return server;
|
||||
}
|
||||
|
||||
if (!isValidIPAddress(s)) {
|
||||
return GetServerByHostname(s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user