Skip to content

Commit 39d5185

Browse files
committed
Update text-formatter.service.ts
Prevent null values
1 parent 85d47c8 commit 39d5185

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/app/core/src/lib/services/formatters/text/text-formatter.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class TextFormatter implements Formatter {
6464

6565
do {
6666
previousValue = decodedValue;
67-
decodedValue = decodedValue.replace(entityRegex, (match) => decodeMap[match] || match);
67+
decodedValue = decodedValue?.replace(entityRegex, (match) => decodeMap[match] || match);
6868
} while (decodedValue !== previousValue); // Repeat until no changes
6969

7070
return decodedValue;
@@ -75,7 +75,7 @@ export class TextFormatter implements Formatter {
7575
* Decodes HTML special characters.
7676
*/
7777
toInternalFormat(value): string {
78-
const formmatedValue = value.replace(/[<>&"'\u00A0-\uFFFF]/g, (match) => {
78+
const formmatedValue = value?.replace(/[<>&"'\u00A0-\uFFFF]/g, (match) => {
7979
const encoded = this.defaultMap[match];
8080
return encoded !== undefined ? encoded : match;
8181
});

0 commit comments

Comments
 (0)