From eac324bc1cd234cd19ee803968fe82dd3d219b9c Mon Sep 17 00:00:00 2001 From: "Dayan C. Galiazzi" Date: Mon, 21 Sep 2020 01:32:02 -0300 Subject: [PATCH] fix: presence event when contact not exists --- src/WAConnection/4.Events.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WAConnection/4.Events.ts b/src/WAConnection/4.Events.ts index 8398844..6386ec3 100644 --- a/src/WAConnection/4.Events.ts +++ b/src/WAConnection/4.Events.ts @@ -25,7 +25,7 @@ export class WAConnection extends Base { const jid = whatsappID(update.id) const contact = this.contacts[jid] - if (jid.endsWith('@s.whatsapp.net')) { // if its a single chat + if (contact && jid.endsWith('@s.whatsapp.net')) { // if its a single chat if (update.t) contact.lastSeen = +update.t else if (update.type === Presence.unavailable && contact.lastKnownPresence !== Presence.unavailable) { contact.lastSeen = unixTimestampSeconds()