From d71ddeada9f21d0a7000ea189d82a7e2268d6321 Mon Sep 17 00:00:00 2001 From: Carlos Villaronga Date: Tue, 10 Dec 2024 11:26:57 -0500 Subject: [PATCH] Update text-formatter.service.ts Prevent null values --- .../lib/services/formatters/text/text-formatter.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/app/core/src/lib/services/formatters/text/text-formatter.service.ts b/core/app/core/src/lib/services/formatters/text/text-formatter.service.ts index 84f293da37..6c01f632fc 100755 --- a/core/app/core/src/lib/services/formatters/text/text-formatter.service.ts +++ b/core/app/core/src/lib/services/formatters/text/text-formatter.service.ts @@ -64,7 +64,7 @@ export class TextFormatter implements Formatter { do { previousValue = decodedValue; - decodedValue = decodedValue.replace(entityRegex, (match) => decodeMap[match] || match); + decodedValue = decodedValue?.replace(entityRegex, (match) => decodeMap[match] || match); } while (decodedValue !== previousValue); // Repeat until no changes return decodedValue; @@ -75,7 +75,7 @@ export class TextFormatter implements Formatter { * Decodes HTML special characters. */ toInternalFormat(value): string { - const formmatedValue = value.replace(/[<>&"'\u00A0-\uFFFF]/g, (match) => { + const formmatedValue = value?.replace(/[<>&"'\u00A0-\uFFFF]/g, (match) => { const encoded = this.defaultMap[match]; return encoded !== undefined ? encoded : match; });