diff --git a/news/3 Code Health/1867.md b/news/3 Code Health/1867.md new file mode 100644 index 000000000000..57590fb445fb --- /dev/null +++ b/news/3 Code Health/1867.md @@ -0,0 +1 @@ +Add better exception handling when parsing responses received from the Jedi language service. diff --git a/src/client/providers/jediProxy.ts b/src/client/providers/jediProxy.ts index 8d7811e161b8..73e1dbe44992 100644 --- a/src/client/providers/jediProxy.ts +++ b/src/client/providers/jediProxy.ts @@ -391,9 +391,15 @@ export class JediProxy implements Disposable { } responses.forEach((response) => { + if (!response) { + return; + } const responseId = JediProxy.getProperty(response, 'id'); - const cmd = >this.commands.get(responseId); - if (cmd === null) { + if (!this.commands.has(responseId)) { + return; + } + const cmd = this.commands.get(responseId); + if (!cmd) { return; } this.lastCmdIdProcessed = cmd.id;