From ad10fb24f333ca1a9b47b553652eaa8d085456b0 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Fri, 23 Aug 2019 10:20:07 +0200 Subject: [PATCH] Catch fetchSurroundingDocs missing anchor (#43661) (#43835) --- src/legacy/core_plugins/kibana/public/context/api/context.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/legacy/core_plugins/kibana/public/context/api/context.ts b/src/legacy/core_plugins/kibana/public/context/api/context.ts index be99fa63b07cc..baecf8a673521 100644 --- a/src/legacy/core_plugins/kibana/public/context/api/context.ts +++ b/src/legacy/core_plugins/kibana/public/context/api/context.ts @@ -72,6 +72,9 @@ function fetchContextProvider(indexPatterns: IndexPatterns, Private: IPrivate) { size: number, filters: Filter[] ) { + if (typeof anchor !== 'object' || anchor === null) { + return []; + } const indexPattern = await indexPatterns.get(indexPatternId); const searchSource = await createSearchSource(indexPattern, filters); const sortDirToApply = type === 'successors' ? sortDir : reverseSortDir(sortDir);