prevent crash if topic graph is clicked while not loaded

This commit is contained in:
barisusakli
2014-10-19 18:37:11 -04:00
parent 7de9b998b5
commit 6dd035a5af

View File

@@ -293,7 +293,9 @@ define('admin/general/dashboard', ['semver'], function(semver) {
graphs.topics = new Chart(topicsCtx).Doughnut([], {responsive: true});
topicsCanvas.onclick = function(evt){
var obj = graphs.topics.getSegmentsAtEvent(evt);
window.open(RELATIVE_PATH + '/topic/' + obj[0].tid);
if (obj && obj[0]) {
window.open(RELATIVE_PATH + '/topic/' + obj[0].tid);
}
};
intervals.graphs = setInterval(updateTrafficGraph, 15000);