Skip to content

Commit

Permalink
check for line existence before trying to remove them
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnth committed Jul 21, 2021
1 parent 40f6bbd commit 8ccd341
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/webapp/resources/js/viewer/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ function ActionChangeTypeSegment(id, newType, viewer, textViewer, controller, se

let actions = []
if(controller.isTextRegion(_oldType) && !controller.isTextRegion(newType)){
let textlines = Object.entries(_segment.textlines).map(([_,t]) => t);
for(let textline of textlines){
actions.push(new ActionRemoveTextLine(textline, viewer, textViewer, segmentation, page, controller, selector, true))
if(_segment.textlines){
let textlines = Object.entries(_segment.textlines).map(([_,t]) => t);
for(let textline of textlines){
actions.push(new ActionRemoveTextLine(textline, viewer, textViewer, segmentation, page, controller, selector, true))
}
}
}
let _actionTextLineRemoval = new ActionMultiple(actions);
Expand Down

0 comments on commit 8ccd341

Please sign in to comment.