fix undefined errors when adding a new rectangle annotation

This commit is contained in:
Dan Percic 2021-04-09 12:35:50 +03:00
parent c7ac26ab1c
commit 0e029b205d

View File

@ -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);
}