Skip to content

Commit f3a41fc

Browse files
committed
Add missing null-checks
1 parent 58a4aad commit f3a41fc

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Diff for: src/server/session.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,13 @@ namespace ts.server {
329329
const seen = createDocumentSpanSet();
330330

331331
perProjectResults.forEach((projectResults, project) => {
332-
for (const result of projectResults) {
333-
// If there's a mapped location, it'll appear in the results for another project
334-
if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
335-
results.push(result);
336-
seen.add(result);
332+
if (projectResults) {
333+
for (const result of projectResults) {
334+
// If there's a mapped location, it'll appear in the results for another project
335+
if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
336+
results.push(result);
337+
seen.add(result);
338+
}
337339
}
338340
}
339341
});
@@ -383,9 +385,11 @@ namespace ts.server {
383385
if (defaultProjectResults?.[0].references[0]?.isDefinition === undefined) {
384386
// Clear all isDefinition properties
385387
perProjectResults.forEach(projectResults => {
386-
for (const referencedSymbol of projectResults) {
387-
for (const ref of referencedSymbol.references) {
388-
delete ref.isDefinition;
388+
if (projectResults) {
389+
for (const referencedSymbol of projectResults) {
390+
for (const ref of referencedSymbol.references) {
391+
delete ref.isDefinition;
392+
}
389393
}
390394
}
391395
});

0 commit comments

Comments
 (0)