Когда я закрываю диалоговое окно без выбора какого-либо значения в диалоговом окне, я получаю следующую ошибку.
core.js:4002 ERROR TypeError: Cannot read property 'CTMSInstitutionName' of null
openDialog(element, i): void {
if(!this.allMatch){
const dialogRef = this.dialog.open(DialogCTMSComponent, {
disableClose: true,
data: { cTMSTableDisplay: this.ctmsDisplay, title: element.ibtInstitutionName + ' / ' + element.ibtInvestigatorFullName, result: this.dataService.matchSiteResult }
});
dialogRef.afterClosed().subscribe(result => {
if(this.dataService.matchSiteResult.CTMSInstitutionName > 0){
this.ctmsValueArray[i].CTMSInstitutionName = this.dataService.matchSiteResult.CTMSInstitutionName;
this.ctmsValueArray[i].CTMSInvestigatorName = this.dataService.matchSiteResult.CTMSInvestigatorName;
this.ctmsValueArray[i].SiteNumber = this.dataService.matchSiteResult.SiteNumber;
this.ctmsValueArray[i].StatusFlag = "M";
this.countryTableDisplay.data[i].siteNumber = this.dataService.matchSiteResult.SiteNumber;
}
this.payloadarray.push(this.ctmsValueArray[i]);
let founndindex = this.ctmsDisplay.findIndex(item => { return (item.ctmsInstitutionName == this.dataService.matchSiteResult.CTMSInstitutionName)});
if(founndindex >= 0){
this.ctmsDisplay.splice(founndindex, 1);
}
if(this.ctmsDisplay.length == 0){
this.allMatch = true;
}
});
}
}
Пожалуйста, дайте мне знать, как обработать эту ошибку.