diff --git a/src/WAConnection/4.Events.ts b/src/WAConnection/4.Events.ts index f16723c..02c361b 100644 --- a/src/WAConnection/4.Events.ts +++ b/src/WAConnection/4.Events.ts @@ -377,12 +377,15 @@ export class WAConnection extends Base { this.on ('CB:action,,read', async json => { const update = json[2][0][1] const jid = whatsappID(update.jid) - const chat = this.chats.get (jid) || await this.chatAdd (jid) - - if (update.type === 'false') chat.count = -1 - else chat.count = 0 - - this.emit ('chat-update', { jid: chat.jid, count: chat.count }) + const chat = this.chats.get (jid) + if(chat) { + if (update.type === 'false') chat.count = -1 + else chat.count = 0 + + this.emit ('chat-update', { jid: chat.jid, count: chat.count }) + } else { + this.logger.warn('recieved read update for unknown chat ' + jid) + } }) this.on ('qr', qr => QR.generate(qr, { small: true }))