@@ -226,9 +226,9 @@ export function updateLineNumberInDatasetForDoubleColumn(
226
226
prevR = Math . max ( nextR - expandThreshold + 1 , 1 ) ;
227
227
} else if ( position === 'bottom' ) {
228
228
const prevLineNode = trNode . previousElementSibling as HTMLElement ;
229
- prevL = parseInt ( ( prevLineNode . children [ 0 ] as HTMLElement ) . innerText ) + 1 ;
229
+ prevL = parseInt ( ( prevLineNode ? .children [ 0 ] as HTMLElement ) ? .innerText ) + 1 ;
230
230
nextL = prevL + expandThreshold - 1 ;
231
- prevR = parseInt ( ( prevLineNode . children [ 2 ] as HTMLElement ) . innerText ) + 1 ;
231
+ prevR = parseInt ( ( prevLineNode ? .children [ 2 ] as HTMLElement ) ? .innerText ) + 1 ;
232
232
nextR = prevR + expandThreshold - 1 ;
233
233
} else {
234
234
const prevLineNode = trNode . previousElementSibling as HTMLElement ;
@@ -244,7 +244,11 @@ export function updateLineNumberInDatasetForDoubleColumn(
244
244
updateExpandUpDownButton ( trNode ) ;
245
245
}
246
246
}
247
+ if ( isNaN ( prevL ) || isNaN ( prevR ) || isNaN ( nextL ) || isNaN ( nextR ) ) {
248
+ return false ;
249
+ }
247
250
setLineNumberInDataset ( trNode , prevL , prevR , nextL , nextR ) ;
251
+ return true ;
248
252
}
249
253
250
254
/*
@@ -272,9 +276,9 @@ export function updateLineNumberInDataset(
272
276
prevR = Math . max ( nextR - expandThreshold + 1 , 1 ) ;
273
277
} else if ( position === 'bottom' ) {
274
278
const prevLineNode = trNode . previousElementSibling as HTMLElement ;
275
- prevL = parseInt ( ( prevLineNode . children [ 0 ] . children [ 0 ] as HTMLElement ) . innerText ) + 1 ;
279
+ prevL = parseInt ( ( prevLineNode ? .children [ 0 ] . children ?. [ 0 ] as HTMLElement ) ? .innerText ) + 1 ;
276
280
nextL = prevL + expandThreshold - 1 ;
277
- prevR = parseInt ( ( prevLineNode . children [ 0 ] . children [ 1 ] as HTMLElement ) . innerText ) + 1 ;
281
+ prevR = parseInt ( ( prevLineNode ? .children [ 0 ] . children ?. [ 1 ] as HTMLElement ) ? .innerText ) + 1 ;
278
282
nextR = prevR + expandThreshold - 1 ;
279
283
} else {
280
284
const prevLineNode = trNode . previousElementSibling as HTMLElement ;
@@ -290,7 +294,11 @@ export function updateLineNumberInDataset(
290
294
updateExpandUpDownButton ( trNode ) ;
291
295
}
292
296
}
297
+ if ( isNaN ( prevL ) || isNaN ( prevR ) || isNaN ( nextL ) || isNaN ( nextR ) ) {
298
+ return false ;
299
+ }
293
300
setLineNumberInDataset ( trNode , prevL , prevR , nextL , nextR ) ;
301
+ return true ;
294
302
}
295
303
296
304
/*
0 commit comments