RED-8711 - check for positions property to be sure it exists and is not null

This commit is contained in:
Valentin Mihai 2024-04-10 12:51:51 +03:00
parent 09aa5eac60
commit 7b8602a9b0

View File

@ -33,7 +33,7 @@ export class RedactionLogService extends GenericService<unknown> {
#filterInvalidEntries(redactionLogEntry: IRedactionLogEntry[]) {
return redactionLogEntry.filter(entry => {
entry.positions = entry.positions.filter(p => !p.rectangle || !!p.rectangle?.length);
entry.positions = entry.positions?.filter(p => !p.rectangle || !!p.rectangle?.length);
const hasPositions = !!entry.positions?.length;
if (!hasPositions) {
this.#toaster.devInfo(`Entry ${entry.id} was skipped because it has no position`);