Skip to content

Commit 325c8b6

Browse files
author
Paul van Brenk
committed
Add a check to make sure we have results.
1 parent 4d3e842 commit 325c8b6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/services/services.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,14 +3573,16 @@ module ts {
35733573

35743574
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
35753575
let results = getOccurrencesAtPositionCore(fileName, position);
3576-
3577-
let sourceFile = getCanonicalFileName(normalizeSlashes(fileName));
3578-
3579-
// ensure the results are in the file we're interested in
3580-
results.forEach((value) => {
3581-
let targetFile = getCanonicalFileName(normalizeSlashes(value.fileName));
3582-
Debug.assert(sourceFile == targetFile, `Unexpected file in results. Found results in ${targetFile} expected only results in ${sourceFile}.`);
3583-
});
3576+
3577+
if (results) {
3578+
let sourceFile = getCanonicalFileName(normalizeSlashes(fileName));
3579+
3580+
// ensure the results are in the file we're interested in
3581+
results.forEach((value) => {
3582+
let targetFile = getCanonicalFileName(normalizeSlashes(value.fileName));
3583+
Debug.assert(sourceFile == targetFile, `Unexpected file in results. Found results in ${targetFile} expected only results in ${sourceFile}.`);
3584+
});
3585+
}
35843586

35853587
return results;
35863588
}

0 commit comments

Comments
 (0)