Fix possible null reference

This commit is contained in:
Michael Lumish 2020-06-16 11:40:22 -07:00
parent 01dbc34eb1
commit f97e27f0c0
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ export class CallCredentialsFilter extends BaseFilter implements Filter {
if (splitPath.length >= 2) { if (splitPath.length >= 2) {
serviceName = splitPath[1]; serviceName = splitPath[1];
} }
const hostname = splitHostPort(stream.getHost()).host; const hostname = splitHostPort(stream.getHost())?.host ?? 'localhost';
/* Currently, call credentials are only allowed on HTTPS connections, so we /* Currently, call credentials are only allowed on HTTPS connections, so we
* can assume that the scheme is "https" */ * can assume that the scheme is "https" */
this.serviceUrl = `https://${hostname}/${serviceName}`; this.serviceUrl = `https://${hostname}/${serviceName}`;