From 26fa99fedc3e2c9499294f81f4ca4cd6467bb8a6 Mon Sep 17 00:00:00 2001 From: tomanikolov Date: Tue, 5 Sep 2017 09:46:42 +0300 Subject: [PATCH] Only return debugInfo if url is passed --- lib/services/debug-service.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/services/debug-service.ts b/lib/services/debug-service.ts index a276e484d4..a55cfb17c0 100644 --- a/lib/services/debug-service.ts +++ b/lib/services/debug-service.ts @@ -95,13 +95,22 @@ export class DebugService extends EventEmitter implements IDebugService { } private getDebugInformation(fullUrl: string): IDebugInformation { - const parseQueryString = true; - const wsQueryParam = parse(fullUrl, parseQueryString).query.ws; - const hostPortSplit = wsQueryParam && wsQueryParam.split(":"); - return { + let debugInfo: IDebugInformation = { url: fullUrl, - port: hostPortSplit && +hostPortSplit[1] + port: 0 }; + + if (fullUrl) { + const parseQueryString = true; + const wsQueryParam = parse(fullUrl, parseQueryString).query.ws; + const hostPortSplit = wsQueryParam && wsQueryParam.split(":"); + debugInfo = { + url: fullUrl, + port: hostPortSplit && +hostPortSplit[1] + }; + } + + return debugInfo; } }