Guard against chartPanel being null which can happen when a region is added but no plot is added to it.