浏览代码

Handle non-existing kernels when removing handlers

Jeremy Tuloup 4 年之前
父节点
当前提交
1e3ab3351b
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      src/handler.ts

+ 7 - 3
src/handler.ts

@@ -223,9 +223,13 @@ export class DebuggerHandler {
       delete this._statusChangedHandlers[widget.id];
       delete this._contextKernelChangedHandlers[widget.id];
 
-      // clear the model if the handler being removed corresponds
-      // to the current active debug session
-      if (this._service.session?.connection?.path === connection?.path) {
+      // Clear the model if the handler being removed corresponds
+      // to the current active debug session, or if the connection
+      // does not have a kernel.
+      if (
+        this._service.session?.connection?.path === connection?.path ||
+        !this._service.session?.connection?.kernel
+      ) {
         const model = this._service.model;
         model.clear();
       }