closes #491, added check to prevent crash in getAnonUserCount

This commit is contained in:
Baris Usakli
2013-11-11 12:40:15 -05:00
parent d770963b69
commit 4ce6ac5af9
4 changed files with 17 additions and 4 deletions

View File

@@ -157,7 +157,7 @@ module.exports.init = function(io) {
for (var i = 0; i < clients.length; ++i) {
var hs = clients[i].handshake;
if (hs && clients[i].state.user.uid === 0) {
if (hs && clients[i].state && clients[i].state.user.uid === 0) {
++anonCount;
}
}
@@ -407,7 +407,7 @@ module.exports.init = function(io) {
return;
}
if (Date.now() - lastPostTime < meta.config.postDelay) {
if (Date.now() - lastPostTime < meta.config.postDelay * 1000) {
posts.emitTooManyPostsAlert(socket);
return;
}