我遇到了一个 TypeError 的问题,虽然我的应用程序仍在正常运行。
如何解决这个问题? 请参考下图:"ERROR TypeError: Cannot read property 'replace' of null"
![enter image description here](https://istack.dev59.com/KIyw6.webp)
if (isInitial) {
// Add Data Rows (initially)
for(const row of rows) {
const clientVisitGuid = row[2];
const location = row[3];
row[5] = row[5].replace(/\//g, '\/\u200B');
const service = row[5];
const rowId = `${service || 'zzz'}_${location}_${clientVisitGuid}`;
const sortString = `${service || 'zzz'}_${location}_${clientVisitGuid}`;
const daysPastDischarge = parseInt(row[6]);
const isMarked = parseInt(row[7]) === 1 ? true : false;
if (cbt.hasBodyRow(rowId) === false) {
const values: Array<[string, string | number]> = [];
let isAllClear = true;
for(let i = 0; i < row.length; i++) {
const colId: string = cbt.headerRow.headerCols[i].id;
const colVal: string | number = row[i];
if (cbt.headerRow.headerCols[i].isFlag === true && colVal !== 1) {
isAllClear = false;
}
values.push([colId, colVal]);
}
const valueHash = hash(JSON.stringify(row));
cbt.addBodyRow(
rowId,
values,
valueHash,
sortString,
daysPastDischarge,
isMarked,
isAllClear,
true,
);
}
}