Bläddra i källkod

Check for shell.currentWidget before trying to activate it.

Ian Rose 7 år sedan
förälder
incheckning
4b289cee47
1 ändrade filer med 6 tillägg och 2 borttagningar
  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,