From 4e92c27189efe2641dfb7f17f847974834acd6ed Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Wed, 15 Apr 2020 12:10:40 -0700 Subject: [PATCH] Notebooks: Fix Issue Around Load Error when Tables Have No Rows (#9980) * Table element children length check * Add another check --- .../notebook/browser/cellViews/textCell.component.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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));