From 4764f91453bb5df321d6509e75094611fc94f894 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 28 Oct 2020 11:34:35 +0300 Subject: [PATCH] fix radiateArray when focusing search with extra CMs around --- edit/global-search.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edit/global-search.js b/edit/global-search.js index 40e377f8..3df729c2 100644 --- a/edit/global-search.js +++ b/edit/global-search.js @@ -902,7 +902,9 @@ onDOMready().then(() => { // produces [i, i+1, i-1, i+2, i-2, i+3, i-3, ...] function radiateArray(arr, focalIndex) { - const result = [arr[focalIndex]]; + const focus = arr[focalIndex]; + if (!focus) return arr; + const result = [focus]; const len = arr.length; for (let i = 1; i < len; i++) { if (focalIndex + i < len) {