The problem happens because the lastActive array which is set here contains the active element which is removed in the onClick, so in the following mousemove event happening after the mouseup event fails because this line contains the removed element, and the call to updateHoverStyle() fails because the dataset is not present anymore.
Expected Behavior
It should be possible to remove a dataset within onClick() and move the mouse just after without any error.
Possible Solution
Update lastActive in the top of handleEvent so that it only includes elements which are still present on the chart.
This hack is a temporary workaround:
onHover: function(event, elements) {
if (self.chart.data.datasets.length === 0) {
this.active.length = 0;
this.lastActive.length = 0;
}
}