Skip to content

Commit ccc965c

Browse files
authored
Cannot read properties of undefined (reading 'commentThreads') (microsoft#196683)
Fixes microsoft#196668
1 parent 70e606d commit ccc965c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/vs/workbench/contrib/comments/common/commentModel.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ export class CommentsModel {
119119
changed.forEach(thread => {
120120
// Find resource that has the comment thread
121121
const matchingResourceIndex = threadsForOwner.findIndex((resourceData) => resourceData.id === thread.resource);
122-
const matchingResourceData = threadsForOwner[matchingResourceIndex];
122+
const matchingResourceData = matchingResourceIndex >= 0 ? threadsForOwner[matchingResourceIndex] : undefined;
123+
if (!matchingResourceData) {
124+
return;
125+
}
123126

124127
// Find comment node on resource that is that thread and replace it
125128
const index = matchingResourceData.commentThreads.findIndex((commentThread) => commentThread.threadId === thread.threadId);

0 commit comments

Comments
 (0)