From bf4afa568a47cf088c01725737aecb4be7df40b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 26 May 2023 15:07:53 +0200 Subject: [PATCH] fix: fix undefined payload check in UI server code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/Bootstrap.ts | 2 +- src/charging-station/ui-server/AbstractUIServer.ts | 2 +- src/charging-station/ui-server/UIHttpServer.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index a1ee4ff2..5e1ac3eb 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -129,7 +129,7 @@ export class Bootstrap extends EventEmitter { public async stop(): Promise { if (isMainThread && this.started === true) { - await this.uiServer?.sendBroadcastChannelRequest( + await this.uiServer?.sendRequestOnBroadcastChannel( this.uiServer.buildProtocolRequest( Utils.generateUUID(), ProcedureName.STOP_CHARGING_STATION, diff --git a/src/charging-station/ui-server/AbstractUIServer.ts b/src/charging-station/ui-server/AbstractUIServer.ts index af5c0129..8552a572 100644 --- a/src/charging-station/ui-server/AbstractUIServer.ts +++ b/src/charging-station/ui-server/AbstractUIServer.ts @@ -46,7 +46,7 @@ export abstract class AbstractUIServer { this.chargingStations.clear(); } - public async sendBroadcastChannelRequest(request: ProtocolRequest): Promise { + public async sendRequestOnBroadcastChannel(request: ProtocolRequest): Promise { const protocolVersion = ProtocolVersion['0.0.1']; this.registerProtocolVersionUIService(protocolVersion); return this.uiServices.get(protocolVersion)?.requestHandler(request); diff --git a/src/charging-station/ui-server/UIHttpServer.ts b/src/charging-station/ui-server/UIHttpServer.ts index a831446b..ccafb084 100644 --- a/src/charging-station/ui-server/UIHttpServer.ts +++ b/src/charging-station/ui-server/UIHttpServer.ts @@ -126,7 +126,7 @@ export class UIHttpServer extends AbstractUIServer { ) ) .then((protocolResponse: ProtocolResponse) => { - if (Utils.isNullOrUndefined(protocolResponse)) { + if (!Utils.isNullOrUndefined(protocolResponse)) { this.sendResponse(protocolResponse); } }) -- 2.34.1