Pārlūkot izejas kodu

Guard against an inactive cell

Steven Silvester 8 gadi atpakaļ
vecāks
revīzija
62e71d4124
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  1. 3 0
      src/notebook/notebook/default-toolbar.ts

+ 3 - 0
src/notebook/notebook/default-toolbar.ts

@@ -356,6 +356,9 @@ class CellTypeSwitcher extends Widget {
    * Update the value of the dropdown from the widget state.
    */
   private _updateValue(widget: Notebook, select: HTMLSelectElement): void {
+    if (!widget.activeCell) {
+      return;
+    }
     let mType: string = widget.activeCell.model.type;
     for (let i = 0; i < widget.childCount(); i++) {
       let child = widget.childAt(i);