aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-12-20 18:52:34 +0000
committerkjeremy <[email protected]>2019-12-20 18:52:34 +0000
commit6049f60a052b4097ab45a631480f8207ac5f6009 (patch)
tree08c131e1433ca40c9dfdf716b4b4f47b77d26ceb
parentbe78e3c224ffcdfafb5d54f7d12b3c2231e9e13e (diff)
Protect against null as revealed by `npm test`
-rw-r--r--editors/code/src/commands/cargo_watch.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 748be535c..ac62bdd48 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -111,8 +111,13 @@ export class CargoWatchProvider implements vscode.Disposable {
111 }, 111 },
112 ); 112 );
113 113
114 if (!this.cargoProcess) {
115 vscode.window.showErrorMessage('Cargo Watch failed to start');
116 return;
117 }
118
114 const stdoutData = new LineBuffer(); 119 const stdoutData = new LineBuffer();
115 this.cargoProcess.stdout.on('data', (s: string) => { 120 this.cargoProcess.stdout?.on('data', (s: string) => {
116 stdoutData.processOutput(s, line => { 121 stdoutData.processOutput(s, line => {
117 this.logInfo(line); 122 this.logInfo(line);
118 try { 123 try {
@@ -124,7 +129,7 @@ export class CargoWatchProvider implements vscode.Disposable {
124 }); 129 });
125 130
126 const stderrData = new LineBuffer(); 131 const stderrData = new LineBuffer();
127 this.cargoProcess.stderr.on('data', (s: string) => { 132 this.cargoProcess.stderr?.on('data', (s: string) => {
128 stderrData.processOutput(s, line => { 133 stderrData.processOutput(s, line => {
129 this.logError('Error on cargo-watch : {\n' + line + '}\n'); 134 this.logError('Error on cargo-watch : {\n' + line + '}\n');
130 }); 135 });