diff --git a/src/vs/base/common/labels.ts b/src/vs/base/common/labels.ts index 1952bcf3aff07d05583075f4d0a1285959246b01..71ed33eb30bc0014429531ad997443871a896454 100644 --- a/src/vs/base/common/labels.ts +++ b/src/vs/base/common/labels.ts @@ -103,7 +103,7 @@ export function shorten(paths: string[]): string[] { for (let otherPathIndex = 0; !match && otherPathIndex < paths.length; otherPathIndex++) { // suffix subpath treated specially as we consider no match 'x' and 'x/...' - if (otherPathIndex !== pathIndex && paths[otherPathIndex].indexOf(subpath) > -1) { + if (otherPathIndex !== pathIndex && paths[otherPathIndex] && paths[otherPathIndex].indexOf(subpath) > -1) { const isSubpathEnding: boolean = (start + subpathLength === segments.length); const isOtherPathEnding: boolean = endsWith(paths[otherPathIndex], subpath);