From: Jukka Kurkela Date: Tue, 28 Jan 2020 16:46:23 +0000 (+0200) Subject: Fix binarySearch for empty dataset (#7023) X-Git-Tag: v3.0.0-alpha~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb6d7f80d133f159df866548be72c642e6f82c62;p=thirdparty%2FChart.js.git Fix binarySearch for empty dataset (#7023) --- diff --git a/src/core/core.interaction.js b/src/core/core.interaction.js index 77780e0d8..797dca4cd 100644 --- a/src/core/core.interaction.js +++ b/src/core/core.interaction.js @@ -52,7 +52,7 @@ function evaluateAllVisibleItems(chart, handler) { function binarySearch(metaset, axis, value, intersect) { const {controller, data, _sorted} = metaset; const iScale = controller._cachedMeta.iScale; - if (iScale && axis === iScale.axis && _sorted) { + if (iScale && axis === iScale.axis && _sorted && data.length) { const lookupMethod = iScale._reversePixels ? _rlookup : _lookup; if (!intersect) { return lookupMethod(data, axis, value);