bufix: sometimes 'this.chats.get(jid)' return null (#803)

This commit is contained in:
P
2021-11-07 14:59:12 -03:00
committed by GitHub
parent e6e8a8e973
commit 24b249430d

View File

@@ -664,7 +664,7 @@ export class WAConnection extends Base {
}
protected emitGroupUpdate = (jid: string, update: Partial<WAGroupMetadata>) => {
const chat = this.chats.get(jid)
if (chat.metadata) Object.assign(chat.metadata, update)
if (chat && chat.metadata) Object.assign(chat.metadata, update)
this.emit ('group-update', { jid, ...update })
}
protected chatUpdateTime = (chat, stamp: number) => this.chats.update (chat.jid, c => c.t = stamp)