From 9df06e8c2e38ccdebee27e77c833b9f813078685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Rolda=CC=83o?= Date: Mon, 18 Jul 2016 22:05:44 +0100 Subject: [PATCH] Check for existence of data element before accessing property --- src/core/core.controller.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 4794cf80a67..398d40d2b38 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -413,9 +413,10 @@ module.exports = function(Chart) { helpers.each(me.data.datasets, function(dataset, datasetIndex) { if (me.isDatasetVisible(datasetIndex)) { - var meta = me.getDatasetMeta(datasetIndex); - if(!meta.data[found._index]._view.skip){ - elementsArray.push(meta.data[found._index]); + var meta = me.getDatasetMeta(datasetIndex), + element = meta.data[found._index]; + if(element && !element._view.skip){ + elementsArray.push(element); } } }, me);