From facefba4ca0098b22f05b21a270aa7c6e2ed6d53 Mon Sep 17 00:00:00 2001 From: Niels Wildeboer Date: Fri, 22 Nov 2024 10:54:17 +0100 Subject: [PATCH] Add null check for PrimaryQueryResult in SharePointSearchService --- .../src/services/searchService/SharePointSearchService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/search-parts/src/services/searchService/SharePointSearchService.ts b/search-parts/src/services/searchService/SharePointSearchService.ts index bbb66a84..ce48a053 100644 --- a/search-parts/src/services/searchService/SharePointSearchService.ts +++ b/search-parts/src/services/searchService/SharePointSearchService.ts @@ -226,6 +226,7 @@ export class SharePointSearchService implements ISharePointSearchService { if (response.ok) { const searchResponse: ISharePointSearchResponse = await response.json(); + if (searchResponse.PrimaryQueryResult) { const refinementResultsRows = searchResponse.PrimaryQueryResult.RefinementResults; const refinementRows: any = refinementResultsRows ? refinementResultsRows.Refiners : []; @@ -237,7 +238,7 @@ export class SharePointSearchService implements ISharePointSearchService { }); }); }); - + } } else { throw new Error(`${response['statusMessage']}`); }