fix: TypeError caused by empty chat

This commit is contained in:
Ace Locker
2020-07-30 16:28:28 +08:00
parent b06f53401f
commit 07291d8ef6

View File

@@ -111,6 +111,7 @@ export default class WAConnectionConnector extends WAConnectionValidator {
let json = await this.registerCallbackOneTime(['response', 'type:chat']) let json = await this.registerCallbackOneTime(['response', 'type:chat'])
if (json[1].duplicate) json = await this.registerCallbackOneTime (['response', 'type:chat']) if (json[1].duplicate) json = await this.registerCallbackOneTime (['response', 'type:chat'])
if (!json[2]) return
json[2].forEach(([_, chat]: [any, WAChat]) => { json[2].forEach(([_, chat]: [any, WAChat]) => {
chat.count = +chat.count chat.count = +chat.count
chat.messages = [] chat.messages = []