Add hasOwnProperty check to GetServer

This commit is contained in:
SagePtr 2022-01-29 23:30:13 +02:00
parent 9ddb1c4379
commit 4483c2bbce

@ -42,8 +42,11 @@ function GetServerByHostname(hostname: string): BaseServer | null {
//Get server by IP or hostname. Returns null if invalid //Get server by IP or hostname. Returns null if invalid
export function GetServer(s: string): BaseServer | null { export function GetServer(s: string): BaseServer | null {
const server = AllServers[s]; if (AllServers.hasOwnProperty(s)) {
if (server) return server; const server = AllServers[s];
if (server) return server;
}
if (!isValidIPAddress(s)) { if (!isValidIPAddress(s)) {
return GetServerByHostname(s); return GetServerByHostname(s);
} }