highslide-software/highcharts.com — Issue #635: Delayed event on null object: Cannot read property 'endResize' of null
Author: aranmike
Created: 2011-12-13 12:31:26+00:00
State: open

I'm using HighCharts 2.1.9 (and the src js so I can debug). I've managed to create a scenario where the resize event of HighChart is still on-going when I destroy the object, and then fails with a very ugly message:

Uncaught TypeError: Cannot read property 'endResize' of null (in Chrome, Firefox's error is much less intuitive)

Anyway, I can tell you exactly what the problem is. At the bottom of the "resize" method (line 8060) there is a setTimeout for firing the end of the resize event. Then the "destroy" function is called, which at line 8360, sets the chart object to null.

Now when fireEndResize() is called, there is no check to see that the chart object is not null.

The easy fix I'm guessing is to simply put in a check and return from the function if chart is null.

I've recreated this because I have the resizing of the HighChart object connected to the events of another visual component which fires far too much, this is an issue I will fix, as this error occurs constantly for me, but even with this fixed, the error could occur for anyone.

Cheers
Mike