diff --git a/src/extension.ts b/src/extension.ts index 5e620a585..7ed619dad 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -742,7 +742,7 @@ const updateCurrentFileIfPython = async ( setPathAndSendMessage(currentPanel, getActivePythonFile() || ""); } - if (utils.getActiveEditorFromPath(currentTextDocument.fileName) === undefined) { + if (currentTextDocument && utils.getActiveEditorFromPath(currentTextDocument.fileName) === undefined) { await vscode.window.showTextDocument(currentTextDocument, vscode.ViewColumn.One); } };