Merge dependabot/npm_and_yarn/poolifier-3.0.1 into combined-prs-branch
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / UIWebSocketServer.ts
index b28b6df76f4d33e85ab2cf82178a86addfc6e94c..e322ef8db9901889344e41f9b97d41d1616c7bb3 100644 (file)
@@ -60,9 +60,9 @@ export class UIWebSocketServer extends AbstractUIServer {
         this.uiServices
           .get(version)
           ?.requestHandler(request)
-          .then((protocolResponse: ProtocolResponse) => {
+          .then((protocolResponse?: ProtocolResponse) => {
             if (!isNullOrUndefined(protocolResponse)) {
-              this.sendResponse(protocolResponse);
+              this.sendResponse(protocolResponse!);
             }
           })
           .catch(Constants.EMPTY_FUNCTION);
@@ -118,7 +118,7 @@ export class UIWebSocketServer extends AbstractUIServer {
   }
 
   public sendResponse(response: ProtocolResponse): void {
-    const responseId = response[0];
+    const responseId = response?.[0];
     try {
       if (this.hasResponseHandler(responseId)) {
         const ws = this.responseHandlers.get(responseId) as WebSocket;
@@ -203,7 +203,7 @@ export class UIWebSocketServer extends AbstractUIServer {
       return false;
     }
 
-    if (validateUUID(request[0]) === false) {
+    if (validateUUID(request?.[0]) === false) {
       logger.error(
         `${this.logPrefix(
           moduleName,