From b79e4784e1c1adeb9d3bda68df8f692ab7661e3e Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Fri, 12 Apr 2019 17:15:11 +0200 Subject: [PATCH] Fix bug #122 --- src/putty.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/putty.ts b/src/putty.ts index ff1021c..cf6c50d 100644 --- a/src/putty.ts +++ b/src/putty.ts @@ -63,7 +63,7 @@ export async function getSession(name?: string, host?: string, username?: string } if (!host) return null; host = host.toLowerCase(); - const hosts = sessions.filter(s => s.hostname.toLowerCase() === host); + const hosts = sessions.filter(s => s.hostname && s.hostname.toLowerCase() === host); if (!username) return hosts[0] || null; username = username.toLowerCase(); return hosts.find(s => !s.username || s.username.toLowerCase() === username) || null;