Skip to content

Commit f0ebd2b

Browse files
Tyriardbaeumer
authored andcommitted
Add null check to terminal link handler
Fixes microsoft#27247
1 parent dbeb66f commit f0ebd2b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,15 @@ export class TerminalLinkHandler {
226226

227227
private _resolvePath(link: string): TPromise<string> {
228228
link = this._preprocessPath(link);
229-
230229
if (!link) {
231230
return TPromise.as(void 0);
232231
}
233232

234233
const linkUrl = this.extractLinkUrl(link);
234+
if (!linkUrl) {
235+
return TPromise.as(void 0);
236+
}
237+
235238
// Open an editor if the path exists
236239
return pfs.fileExists(linkUrl).then(isFile => {
237240
if (!isFile) {
@@ -292,6 +295,9 @@ export class TerminalLinkHandler {
292295
*/
293296
public extractLinkUrl(link: string): string {
294297
const matches: string[] = this._localLinkRegex.exec(link);
298+
if (!matches) {
299+
return null;
300+
}
295301
return matches[1];
296302
}
297303
}

0 commit comments

Comments
 (0)