From 0d376d890ceb406cabd2b4281deebf5f4038a78c Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 14 May 2018 17:02:35 -0700 Subject: [PATCH] Fix NPE when search returns no results --- src/vs/workbench/api/node/extHostSearch.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/extHostSearch.ts b/src/vs/workbench/api/node/extHostSearch.ts index ce141855cab..60c3cb5c95a 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); } -- GitLab