[ACS-9012] Add missing null check for truncate pipe (#10461)

This commit is contained in:
MichalKinas 2024-12-05 14:02:27 +01:00 committed by GitHub
parent 2b0100466a
commit bace3b9dcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,6 +23,6 @@ import { Pipe, PipeTransform } from '@angular/core';
})
export class TruncatePipe implements PipeTransform {
transform(value: string, maxTextLength = 250, ellipsis = '...') {
return value.length > maxTextLength ? value.slice(0, maxTextLength) + ellipsis : value;
return value?.length > maxTextLength ? value.slice(0, maxTextLength) + ellipsis : value;
}
}