浏览代码

Fix handling of inspector source

Steven Silvester 8 年之前
父节点
当前提交
14614de79f
共有 2 个文件被更改,包括 10 次插入2 次删除
  1. 5 1
      src/console/plugin.ts
  2. 5 1
      src/notebook/plugin.ts

+ 5 - 1
src/console/plugin.ts

@@ -93,7 +93,11 @@ function activateConsole(app: JupyterLab, services: IServiceManager, rendermime:
 
   // Set the source of the code inspector to the current console.
   tracker.currentChanged.connect((sender, args) => {
-    inspector.source = args.newValue.content.inspectionHandler;
+    if (args.newValue) {
+      inspector.source = args.newValue.content.inspectionHandler;
+    } else {
+      inspector.source = null;
+    }
   });
 
   // Set the main menu title.

+ 5 - 1
src/notebook/plugin.ts

@@ -178,7 +178,11 @@ function activateNotebookHandler(app: JupyterLab, registry: IDocumentRegistry, s
 
   // Set the source of the code inspector to the current console.
   tracker.currentChanged.connect((sender, args) => {
-    inspector.source = args.newValue.content.inspectionHandler;
+    if (args.newValue) {
+      inspector.source = args.newValue.content.inspectionHandler;
+    } else {
+      inspector.source = null;
+    }
   });
 
   // Add main menu notebook menu.