mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Previously, calling getLabelMoment with an out of bound index would cause an error such as this: ``` Uncaught TypeError: Cannot read property 'null' of undefined ``` This happens because there is not always guaranteed to be a labelMoment on at the current datasetIndex. One example of this is practice comes from a this function call: ```js // since the are not always guaranteed to be at least two labelMoments // \ / this index can be out of bounds // | var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6; ``` This patch simply ensures that the `labelMoments` for the `datasetIndex` are defined before accessing properties on it.