From 34ffbaea09aa1590e075076a9dfae0be1c18cf60 Mon Sep 17 00:00:00 2001 From: Mariano Date: Tue, 14 Mar 2017 14:12:33 -0300 Subject: [PATCH] Fix issue when componentWillUnmount() When componentWillUnmount, it tries to get chart object from this.state and execute destroy() function. This is not validating when chart is undefined or null. This PR, only verifies that condition. --- lib/core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core.js b/lib/core.js index b39d67b..feb75dc 100644 --- a/lib/core.js +++ b/lib/core.js @@ -35,7 +35,8 @@ module.exports = { classData.componentWillUnmount = function() { var chart = this.state.chart; - chart.destroy(); + if(chart) + chart.destroy(); }; classData.componentWillReceiveProps = function(nextProps) {