提交 2b67a247 编写于 作者: D Daniel Imms

Add null check when there is no active file

上级 71263ed4
......@@ -118,9 +118,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
if (root) {
terminalService.openTerminal(root.fsPath);
} else {
//Opens current file's folder, if no folder is open in editor
const path = historyService.getLastActiveFile().fsPath;
terminalService.openTerminal(paths.dirname(path));
// Opens current file's folder, if no folder is open in editor
const activeFile = historyService.getLastActiveFile();
if (activeFile) {
terminalService.openTerminal(paths.dirname(activeFile.fsPath));
}
}
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册