guard this.* access in Debugger.shutdown()/stop()/kill()
diff --git a/src/debugger.js b/src/debugger.js
index e43c8e8..fc24b11 100644
--- a/src/debugger.js
+++ b/src/debugger.js
@@ -161,7 +161,9 @@
async stop() {
this.running = false;
- this.agentMgr.stop();
+ if (this.agentMgr) {
+ this.agentMgr.stop();
+ }
if (this.runPromise) {
// wait for the main loop to gracefully end, which will call shutdown()
@@ -174,7 +176,9 @@
async kill() {
this.running = false;
- this.agentMgr.stop();
+ if (this.agentMgr) {
+ this.agentMgr.stop();
+ }
await this.shutdown();
}
@@ -189,9 +193,15 @@
// need to shutdown everything even if some fail, hence tryCatch() for each
- await this.tryCatch(this.agentMgr.shutdown());
- await this.tryCatch(this.invoker.stop());
- await this.tryCatch(this.watcher.stop());
+ if (this.agentMgr) {
+ await this.tryCatch(this.agentMgr.shutdown());
+ }
+ if (this.invoker) {
+ await this.tryCatch(this.invoker.stop());
+ }
+ if (this.watcher) {
+ await this.tryCatch(this.watcher.stop());
+ }
// only log this if we started properly
if (this.ready) {