Add null check to terminal link handler

Fixes #27247
This commit is contained in:
Daniel Imms 2017-05-25 11:11:40 -07:00
parent f479fcd2e5
commit 796f945a2d

View file

@ -226,12 +226,15 @@ export class TerminalLinkHandler {
private _resolvePath(link: string): TPromise<string> {
link = this._preprocessPath(link);
if (!link) {
return TPromise.as(void 0);
}
const linkUrl = this.extractLinkUrl(link);
if (!linkUrl) {
return TPromise.as(void 0);
}
// Open an editor if the path exists
return pfs.fileExists(linkUrl).then(isFile => {
if (!isFile) {
@ -292,6 +295,9 @@ export class TerminalLinkHandler {
*/
public extractLinkUrl(link: string): string {
const matches: string[] = this._localLinkRegex.exec(link);
if (!matches) {
return null;
}
return matches[1];
}
}