diff --git a/src/vs/workbench/api/node/extHostSearch.ts b/src/vs/workbench/api/node/extHostSearch.ts index ce141855cab0ebc5201269c799a32666b359e828..60c3cb5c95a2dd2bb97e5ebeec48500433b3f614 100644 --- a/src/vs/workbench/api/node/extHostSearch.ts +++ b/src/vs/workbench/api/node/extHostSearch.ts @@ -188,7 +188,9 @@ class TextSearchResultsCollector { } private pushToCollector(): void { - const size = this._currentFileMatch.lineMatches.reduce((acc, match) => acc + match.offsetAndLengths.length, 0); + const size = this._currentFileMatch ? + this._currentFileMatch.lineMatches.reduce((acc, match) => acc + match.offsetAndLengths.length, 0) : + 0; this._batchedCollector.addItem(this._currentFileMatch, size); }