From fdd8ed7a6f1e35ec50b72f903d94f55754c43c72 Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Sat, 26 Jan 2013 18:11:28 +0000 Subject: [PATCH] Prevent profile break on no-stats bug --- modules/users/pages.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/users/pages.js b/modules/users/pages.js index 386f96b..b129338 100644 --- a/modules/users/pages.js +++ b/modules/users/pages.js @@ -28,11 +28,17 @@ var pages = function(dbot) { var chanData = dbot.api.stats.getChanStats(connection, channel, ["freq"]); var chanFreq = []; - for(var i=0; i <= 6; i++){ - for(var j=0; j <= 23; j++){ - chanFreq.push(chanData.fields.freq.raw[i][j]); + + if(chanData){ + for(var i=0; i <= 6; i++){ + for(var j=0; j <= 23; j++){ + chanFreq.push(chanData.fields.freq.raw[i][j]); + } } } + else{ + for (var i = 0; i < 168; i++) chanFreq[i] = 0; + } var userData = { "active": [], "inactive": [], "offline": []}; var reply = dbot.api.stats.getChanUsersStats(connection, channel, [