ov-components: Avoid null pointer

pull/839/head
Carlos Santos 2024-07-26 10:29:55 +02:00
parent 3f1334b65d
commit 52564b5f5d
1 changed files with 6 additions and 1 deletions

View File

@ -366,7 +366,12 @@ export class OpenViduComponentsConfigService {
* @returns The base href of the application as a string. * @returns The base href of the application as a string.
*/ */
getBaseHref(): 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) { if (baseHref) {
return baseHref; return baseHref;
} }