浏览代码

Check for shell.currentWidget before trying to activate it.

Ian Rose 7 年之前
父节点
当前提交
4b289cee47
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      packages/application-extension/src/index.tsx

+ 6 - 2
packages/application-extension/src/index.tsx

@@ -286,7 +286,9 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
         app.shell.expandLeft();
       } else {
         app.shell.collapseLeft();
-        app.shell.activateById(app.shell.currentWidget.id);
+        if (app.shell.currentWidget) {
+          app.shell.activateById(app.shell.currentWidget.id);
+        }
       }
     },
     isToggled: () => !app.shell.leftCollapsed,
@@ -302,7 +304,9 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
         app.shell.expandRight();
       } else {
         app.shell.collapseRight();
-        app.shell.activateById(app.shell.currentWidget.id);
+        if (app.shell.currentWidget) {
+          app.shell.activateById(app.shell.currentWidget.id);
+        }
       }
     },
     isToggled: () => !app.shell.rightCollapsed,