diff --git a/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts b/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts index 081e78d255..8b16a9944c 100644 --- a/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts @@ -307,9 +307,13 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges { for (let element of hostElem.children) { if (element.nodeName.toLowerCase() === 'table') { // add table header and table rows. - children.push(element.children[0]); - for (let trow of element.children[1].children) { - children.push(trow); + if (element.children.length > 0) { + children.push(element.children[0]); + if (element.children.length > 1) { + for (let trow of element.children[1].children) { + children.push(trow); + } + } } } else if (element.children.length > 1) { children = children.concat(this.getChildren(element));