Fix a crash in renderer when a channel has no messages

This commit is contained in:
chylex 2017-05-31 14:52:59 +02:00
parent 5bca25d019
commit 170c61b3bd

View File

@ -35,7 +35,7 @@ SAVEFILE.prototype.getUserById = function(user){
};
SAVEFILE.prototype.getMessageCount = function(channel){
return Object.keys(this.data[channel]).length || 0;
return Object.keys(this.getMessages(channel)).length;
};
SAVEFILE.prototype.getAllMessages = function(){
@ -49,5 +49,5 @@ SAVEFILE.prototype.getAllMessages = function(){
};
SAVEFILE.prototype.getMessages = function(channel){
return this.data[channel] || [];
return this.data[channel] || {};
};