浏览代码

Make sure args exist when kernel changes are handled by the notebook panel.

Afshin Darian 6 年之前
父节点
当前提交
7efbb31d67
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      packages/notebook/src/panel.ts

+ 7 - 5
packages/notebook/src/panel.ts

@@ -133,16 +133,18 @@ export class NotebookPanel extends DocumentWidget<Notebook, INotebookModel> {
     sender: any,
     args: Session.IKernelChangedArgs
   ): void {
-    if (!this.model || !args.newValue) {
+    const kernel = args && args.newValue;
+
+    if (!this.model || !kernel) {
       return;
     }
-    let { newValue } = args;
-    newValue.ready.then(() => {
+
+    kernel.ready.then(() => {
       if (this.model) {
-        this._updateLanguage(newValue.info.language_info);
+        this._updateLanguage(kernel.info.language_info);
       }
     });
-    this._updateSpec(newValue);
+    this._updateSpec(kernel);
   }
 
   /**