From 0e029b205d19d28978d0919c18e25bdc786c0370 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Fri, 9 Apr 2021 12:35:50 +0300 Subject: [PATCH] fix undefined errors when adding a new rectangle annotation --- .../components/file-workload/file-workload.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts index 7339cc2c8..a56d1d7f9 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts @@ -64,7 +64,7 @@ export class FileWorkloadComponent { } public annotationIsSelected(annotation: AnnotationWrapper) { - return this.selectedAnnotations?.find((a) => a.id === annotation.id); + return this.selectedAnnotations?.find((a) => a?.id === annotation.id); } public logAnnotation(annotation: AnnotationWrapper) { @@ -140,7 +140,7 @@ export class FileWorkloadComponent { if (!this.selectedAnnotations || this.selectedAnnotations.length === 0) { return; } - const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[annotation-id="${this.firstSelectedAnnotation.id}"].active`); + const elements: any[] = this._annotationsElement.nativeElement.querySelectorAll(`div[annotation-id="${this.firstSelectedAnnotation?.id}"].active`); FileWorkloadComponent._scrollToFirstElement(elements); }