From d57b30c8794d5c0211ca797c0f44f93cbd0a1900 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 28 Feb 2022 09:37:16 -0800 Subject: [PATCH] Fix for a crash when loading environments with no info --- news/2 Fixes/18594.md | 1 + src/client/interpreter/display/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 news/2 Fixes/18594.md diff --git a/news/2 Fixes/18594.md b/news/2 Fixes/18594.md new file mode 100644 index 000000000000..0dcb0771f3f5 --- /dev/null +++ b/news/2 Fixes/18594.md @@ -0,0 +1 @@ +Fix for a crash when loading environments with no info. diff --git a/src/client/interpreter/display/index.ts b/src/client/interpreter/display/index.ts index ea09edefa89d..dfdea218a42c 100644 --- a/src/client/interpreter/display/index.ts +++ b/src/client/interpreter/display/index.ts @@ -119,11 +119,11 @@ export class InterpreterDisplay implements IInterpreterDisplay, IExtensionSingle ); this.interpreterPath = interpreter.path; } - let text = interpreter.detailedDisplayName!; + let text = interpreter.detailedDisplayName; if (this.experiments.inExperimentSync(InterpreterStatusBarPosition.Pinned)) { - text = text.startsWith('Python') ? text.substring('Python'.length).trim() : text; + text = text?.startsWith('Python') ? text?.substring('Python'.length)?.trim() : text; } - this.statusBar.text = text; + this.statusBar.text = text!; this.currentlySelectedInterpreterPath = interpreter.path; } else { this.statusBar.tooltip = '';