diff --git a/src/structures/Chat.js b/src/structures/Chat.js index 13d5af5..8cf1c19 100644 --- a/src/structures/Chat.js +++ b/src/structures/Chat.js @@ -184,7 +184,8 @@ class Chat extends Base { } msgs.sort((a, b) => (a.t > b.t) ? 1 : -1); - return msgs.splice(msgs.length - limit).map(m => window.WWebJS.getMessageModel(m)); + if (msgs.length > limit) msgs = msgs.splice(msgs.length - limit); + return msgs.map(m => window.WWebJS.getMessageModel(m)); }, this.id._serialized, searchOptions.limit);