From 52564b5f5d60e1af7092d8e923165129cf3694fb Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Fri, 26 Jul 2024 10:29:55 +0200 Subject: [PATCH] ov-components: Avoid null pointer --- .../config/openvidu-components-angular.config.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts index 194d40f414..fd0b20df09 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/services/config/openvidu-components-angular.config.service.ts @@ -366,7 +366,12 @@ export class OpenViduComponentsConfigService { * @returns The base href of the application as a string. */ getBaseHref(): string { - const baseHref = this.document.getElementsByTagName('base')[0].href; + const base = this.document.getElementsByTagName('base'); + if (!base || base.length === 0) { + return '/'; + } + + const baseHref = base[0].href; if (baseHref) { return baseHref; }